logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: Odd code in sys/amd64/amd64/syscall.c: msg#00048

Subject: Re: Odd code in sys/amd64/amd64/syscall.c
On Sat, Oct 27, 2007 at 08:08:48PM +0100, David Laight wrote:
> Browsing through the kernel code I spotted the following snippet in
> the syscall return path for amd64:
> 
>         switch (error) {
>         case 0:
>                 frame->tf_rax = rval[0];
> #ifndef COMPAT_LINUX
>                 frame->tf_rdx = rval[1];
> #endif
>                 frame->tf_rflags &= ~PSL_C;     /* carry bit */
>                 break;
> 
> The code always passes rval[0] back out to userland in %rax,
> and passes out rval[1] in %rdx unless COMPAT_LINUX is defined!
> 
> This looks bogus, if netbsd needs to return rval[1] then it should
> be doing it inconditionally, possibly netbsd doesn't need it - but
> some linux syscall does?  In which case the test is reversed.

Answering myself!
Netbsd does need it, linux wouldn't - but the linux system call code
has its own copy of syscall functions (it did once use the netbsd copy)
but that got changed way before the #if was added.
I've removed the #if (rdx is set on syscall return).

        David

-- 
David Laight: david@xxxxxxxxx




Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>