Clarify comment.
This commit is contained in:
parent
330a187b8f
commit
092fd00d56
|
@ -134,25 +134,10 @@
|
||||||
jmp L(pseudo_end);
|
jmp L(pseudo_end);
|
||||||
#endif /* PIC */
|
#endif /* PIC */
|
||||||
|
|
||||||
/* Linux/x86-64 takes system call arguments in registers:
|
/* The Linux/x86-64 kernel expects the system call parameters in
|
||||||
|
registers according to the following table:
|
||||||
|
|
||||||
Register setup:
|
syscall number rax
|
||||||
system call number rax
|
|
||||||
arg 1 rdi
|
|
||||||
arg 2 rsi
|
|
||||||
arg 3 rdx
|
|
||||||
arg 4 rcx
|
|
||||||
arg 5 r8
|
|
||||||
arg 6 r9
|
|
||||||
|
|
||||||
return address from
|
|
||||||
syscall rcx
|
|
||||||
additionally clobered: r12-r15,rbx,rbp
|
|
||||||
eflags from syscall r11
|
|
||||||
|
|
||||||
The compiler is going to form a call by coming here, through PSEUDO, with arguments:
|
|
||||||
|
|
||||||
syscall number in the DO_CALL macro
|
|
||||||
arg 1 rdi
|
arg 1 rdi
|
||||||
arg 2 rsi
|
arg 2 rsi
|
||||||
arg 3 rdx
|
arg 3 rdx
|
||||||
|
@ -160,10 +145,30 @@
|
||||||
arg 5 r8
|
arg 5 r8
|
||||||
arg 6 r9
|
arg 6 r9
|
||||||
|
|
||||||
We have to take care that the stack is alignedto 16 bytes. When
|
The Linux kernel uses and destroys internally these registers:
|
||||||
|
return address from
|
||||||
|
syscall rcx
|
||||||
|
additionally clobered: r12-r15,rbx,rbp
|
||||||
|
eflags from syscall r11
|
||||||
|
|
||||||
|
Normal function call, including calls to the system call stub
|
||||||
|
functions in the libc, get the first six parameters passed in
|
||||||
|
registers and the seventh parameter and later on the stack. The
|
||||||
|
register use is as follows:
|
||||||
|
|
||||||
|
system call number in the DO_CALL macro
|
||||||
|
arg 1 rdi
|
||||||
|
arg 2 rsi
|
||||||
|
arg 3 rdx
|
||||||
|
arg 4 rcx
|
||||||
|
arg 5 r8
|
||||||
|
arg 6 r9
|
||||||
|
|
||||||
|
We have to take care that the stack is aligned to 16 bytes. When
|
||||||
called the stack is not aligned since the return address has just
|
called the stack is not aligned since the return address has just
|
||||||
been pushed.
|
been pushed.
|
||||||
|
|
||||||
|
|
||||||
Syscalls of more than 6 arguments are not supported. */
|
Syscalls of more than 6 arguments are not supported. */
|
||||||
|
|
||||||
#undef DO_CALL
|
#undef DO_CALL
|
||||||
|
|
Loading…
Reference in New Issue