<分区>
在书中Low-Level Programming: C, Assembly, and Program Execution on Intel® 64 Architecture它说,
On system call arguments The arguments for system calls are stored in a different set of registers than those for functions. The fourth argument is stored in
r10
, while a function accepts the fourth argument inrcx
!The reason is that
syscall
instruction implicitly usesrcx
. System calls cannot accept more than six arguments.
你可以看到这个Stack Overflow post里面也提到了这个,
A system-call is done via the syscall instruction. This clobbers %rcx and %r11, as well as %rax, but other registers are preserved.
我理解破坏 rax
来存储返回码,但为什么 rcx
和 r11
在 syscall
中被破坏>?是否有破坏 rcx
/r11
的特定系统调用的列表?有破坏的约定吗?它们在任何系统调用中都被认为是安全的吗?