From: Ronald Monthero <debug.penguin32@gmail.com>
To: alx@kernel.org
Cc: linux-man@vger.kernel.org
Subject: Documentation: Architecture/ABI calling convention table - syscall( )
Date: Wed, 14 Feb 2024 23:26:39 +1000 [thread overview]
Message-ID: <CALk6Uxoss7s-rxsKW=dcGWd9rmj3xnLksQvLn7Cyb7EvdSA2Ag@mail.gmail.com> (raw)
Hello,
Below is in relation to architecture calling standards table for man
syscall, for the indicated at [1] , [2] and [3] need to be changed
perhaps. ( arg4 of x86-64 architecture needs to be rcx instead of r10
and the x32 arch table values needs replacement with exx register
naming respectively. And also the return value register table for x32
needs to be eax and edx for return val and return val2 respectively )
------------
Arch/ABI arg1 arg2 arg3 arg4 arg5 arg6 arg7 Notes
─────────────────────────────
────────
alpha a0 a1 a2 a3 a4 a5 -
arc r0 r1 r2 r3 r4 r5 -
arm/OABI r0 r1 r2 r3 r4 r5 r6
arm/EABI r0 r1 r2 r3 r4 r5 r6
arm64 x0 x1 x2 x3 x4 x5 -
blackfin R0 R1 R2 R3 R4 R5 -
i386 ebx ecx edx esi edi ebp -
ia64 out0 out1 out2 out3 out4 out5 -
m68k d1 d2 d3 d4 d5 a0 -
microblaze r5 r6 r7 r8 r9 r10 -
mips/o32 a0 a1 a2 a3 - - - 1
mips/n32,64 a0 a1 a2 a3 a4 a5 -
nios2 r4 r5 r6 r7 r8 r9 -
parisc r26 r25 r24 r23 r22 r21 -
powerpc r3 r4 r5 r6 r7 r8 r9
powerpc64 r3 r4 r5 r6 r7 r8 -
riscv a0 a1 a2 a3 a4 a5 -
s390 r2 r3 r4 r5 r6 r7 -
s390x r2 r3 r4 r5 r6 r7 -
superh r4 r5 r6 r7 r0 r1 r2
sparc/32 o0 o1 o2 o3 o4 o5 -
sparc/64 o0 o1 o2 o3 o4 o5 -
tile R00 R01 R02 R03 R04 R05 -
x86-64 rdi rsi rdx r10 r8 r9 -
^^----- ==> need to
be rcx ? << [1]
x32 rdi rsi rdx r10 r8 r9 - ==> to be
exx regs << [2]
=> For x86-64 architecture the function calling standards
the arg4 register should be rcx
=> And for x32 it needs to be replaced with x86 32 bit register variants
as arg1 = edi , arg2 = esi , arg3 = edx, arg4 = ecx
2) Also noticed the return value register table needs similar
change for x86-32 bit
it needs to be eax instead of rax and edx instead of rdx.
Arch/ABI Instruction System Ret Ret Error Notes
call # val val2
─────────────────────────────
< snipped >
sparc/32 t 0x10 g1 o0 o1 psr/csr 1, 6
sparc/64 t 0x6d g1 o0 o1 psr/csr 1, 6
tile swint1 R10 R00 - R01 1
x86-64 syscall rax rax rdx - 5
x32 syscall rax rax rdx - 5
^^^-----^^^--^^^-------------------> << [3]
=> for x32 return register has to be changed as
rax => eax and rdx => edx
BR,
ronald
next reply other threads:[~2024-02-14 13:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-14 13:26 Ronald Monthero [this message]
2024-02-14 16:39 ` Documentation: Architecture/ABI calling convention table - syscall( ) Eugene Syromyatnikov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CALk6Uxoss7s-rxsKW=dcGWd9rmj3xnLksQvLn7Cyb7EvdSA2Ag@mail.gmail.com' \
--to=debug.penguin32@gmail.com \
--cc=alx@kernel.org \
--cc=linux-man@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).