Re: [PATCH] syscall.2: fix wrong retval register number in alpha architecture

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 12/4/18 2:26 AM, snyh wrote:
> The normal Alpha C ABI use a0~a5 to pass arguments and use v0 as the
> return value register.   see here
> https://www2.cs.arizona.edu/projects/alto/Doc/local/alpha.register.html
> 
> The syscall ABI use v0 as the trap number, a0~a5 to pass arguments and
> use a3 as a indicator(bool type) whether has a error occurred.
> 
> We can also see the libc's syscall wrapper implements  at here
> https://code.woboq.org/userspace/glibc/sysdeps/unix/sysv/linux/alpha/syscall.S.html
> The v0 is the normal used as return register, and we can see the
> return processing doesn't do anything about a0 which is the wrong
> register of currently syscall(2) description.
> 
> p.s.  I found this wrong description because I'm porting Go gc to a
> new CPU architecture which is similar to Alpha, And I use the wrong
> register at first, then I have inspect the kernel code and objdump to
> ensure the right syscall ABI.

Okay -- there's a lot of good info there (including your 
expertise/experience), that I've added to the commit message.

I've applied the patch. Thanks!

Michael

> On Tue, Dec 4, 2018 at 5:16 AM Michael Kerrisk (man-pages)
> <mtk.manpages@xxxxxxxxx> wrote:
>>
>> [CC += Mike, original author of the text]
>>
>> On 12/3/18 4:07 AM, snyh wrote:
>>> alpha use v0 e.g. $0 as the return value register both in
>>> syscall abi and C abi.
>>>
>>> see also
>>> https://github.com/torvalds/linux/blob/master/arch/alpha/kernel/entry.S#L479
>>
>> I need a little help here, probably in the form of a more
>> detailed commit message. Can you explain how one can verify
>> the point made in the patch? (I'm not wiser after following
>> the above link.)
>>
>> Thanks,
>>
>> Michael
>>
>>> diff --git a/man2/syscall.2 b/man2/syscall.2
>>> index 3f4d64c..11e1416 100644
>>> --- a/man2/syscall.2
>>> +++ b/man2/syscall.2
>>> @@ -181,7 +181,7 @@ and the register used to signal an error.
>>>  l2     l2      l2      l2      l2      l.
>>>  arch/ABI       instruction     syscall #       retval  error   Notes
>>>  _
>>> -alpha  callsys v0      a0      a3      [1]
>>> +alpha  callsys v0      v0      a3      [1]
>>>  arc    trap0   r8      r0      -
>>>  arm/OABI       swi NR  -       a1      -       [2]
>>>  arm/EABI       swi 0x0 r7      r0      -
>>
>>
>>
>>
>> --
>> Michael Kerrisk
>> Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
>> Linux/UNIX System Programming Training: http://man7.org/training/
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux