[lkml]   [2002]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Syscall changes registers beyond %eax, on linux-i386
Petr Vandrovec wrote:
> On 19 Sep 02 at 13:22, Richard B. Johnson wrote:
>>>>>A short snippet of sys_poll, with irrelavant data removed.
>>>>>sys_poll(struct pollfd *ufds, .. , ..) {
>>>>> ...
>>>>> ufds++;
>>>>> ...
>>Well which one? Here is an ioctl(). It certainly modifies one
>>of its parameter values.
> poll(), as was already noted. Program below should
> print same value for B= and F=, but it reports f + 8*c instead
> (where c = number of filedescriptors passed to poll).
> And you must call it from assembly, as your calls to getpid() or
> ioctl() (or poll()) are wrapped in libc - and glibc's code begins with
> push %ebx because of %ebx is used by -fPIC code.
> It is questinable whether we should try to not modify parameters
> passed into functions. It is definitely nice behavior, but I think
> that we should only guarantee that syscalls do not modify unused
> registers.
> Petr Vandrovec

Now that I've thought about it more, I think the best solution is to go
through all the syscalls (a big job, I know), and declare the parameters
as const, so that gcc knows it can't modify them, and will throw a
warning if we try.

Brian Gerst

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:29    [W:0.059 / U:1.892 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site