我想检查在glibc中执行系统调用的代码。我发现了这样的事情。syscall是x86_64上的一条指令吗?
ENTRY (syscall)
movq %rdi, %rax /* Syscall number -> rax. */
movq %rsi, %rdi /* shift arg1 - arg5. */
movq %rdx, %rsi
movq %rcx, %rdx
movq %r8, %r10
movq %r9, %r8
movq 8(%rsp),%r9 /* arg6 is on the stack. */
syscall /* Do the system call. */
cmpq $-4095, %rax /* Check %rax for error. */
jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */
L(pseudo_end):
ret /* Return to caller. */
现在我的问题是如果系统调用(在cmpq
指令之前)是一条指令?其次,如果它是一条指令,那么ENTRY(系统调用)的含义是什么? ENTRY的相同名称(我不知道ENTRY是什么)和指令?其次,什么是L(pseudo_end)?
是的。它与x86中的int 0x80相同。 – Dave
请注意,通常使用专用代码来进行每次系统调用,从常量(保存寄存器)设置'%rax',并跳过设置未使用的参数。 – o11c