BetterOS.org : An attempt to make computer machines run better


HOME | BETTER LINUX | GAMES | SOFTWARE | TUTORIALS | ABOUT | REFERENCES | FORUM | WEB LOG |

Reference Material: INDEX | SYSCALLS | CALLING CONVENTIONS | AMD64 INSTRUCTIONS | X11 | REUSABLE CODE |

Reference Material

INTRODUCTION:
This is meant to be a useful list calling conventions for various archetectures, all in one place, including function calls and system calls. This is not an exhaustive list, just a useful reference. It mainly focuses on Linux for x86 / x86_64 and arm / arm64, since those are the systems I regularly work with.


SYSTEM CALLS:
ConventionArgumentsInformation
Arch / ConventionSyscall numberReturn1234567InstructionNotes
i386eaxeaxebxecxedxesiediebp int 0x80
amd64raxraxrdirsirdxr10r8r9 syscall
arm/EABIr7r0r0r1r2r3r4r5r6swi 0
arm/OABIa1a1a2a3a4v1v2v3swi syscall
arm64x8x0x0x1x2x3x4x5 svc #0

FUNCTION CALLS:
ConventionReturnArgumentsInformation
Arch / ConventionAddressValue1234567Notes
i386/gcc eax or st0stackAll arguments are passed on the stack. eax is used for 32-bit return values, st0 is used for larger values.
i386/fastcall eax or st0ecxedxstackFirst two arguments use ecx and edx, all remaining arguments are passed on the stack. eax is used for 32-bit return values, st0 is used for larger values.
amd64/integer raxrdirsirdxrcxr8r9stack64-bit arguments use rdi, rsi, rdx, rcx, r8, and r9, 128-bit arguments use xmm0-7.
amd64/float xmm0xmm0xmm1xmm2xmm3xmm4xmm5xmm6
armr14r0r0r1r2r3 If more than 4 arguments are passed, all are stored in memory and r0 holds a pointer to that memory.
arm64x30x0x0x1x2x3x4x5x6