Sunday, March 9, 2008

System Call Argument Passing

X86:

Windows:
The system call number is passed in the EAX register, and the stack stores the caller arguments.

Linux:
http://manugarg.googlepages.com/systemcallinlinux2_6.html

X64:

Windows:
A system-call is done via the syscall instruction. Parameters are passed by %rcx,%rdx, %r8 and %r9, the rest are passed on stack.

Linux:
A system-call is done via the syscall instruction. Parameters are passed by %rdi,%rsi, %rdx, %r10, %r8 and %r9.The kernel destroys
registers %rcx and %r11.

No comments: