28,13 → 28,30 |
|
.text |
|
.globl __syscall |
.global __syscall |
|
## Make a system call. |
# |
# @param rdi First argument. |
# @param rsi Second argument. |
# @param rdx Third argument. |
# @param rcx Fourth argument. |
# @param r8 Fifth argument. |
# @param r9 Sixth argument. |
# @param 8(%rsp) Syscall number. |
# |
# @return The return value will be stored in RAX. |
# |
__syscall: |
# |
# Move the syscall number into RAX. |
movslq 8(%rsp), %rax |
|
__syscall: |
# rcx gets rewritten on syscall |
movq %rcx, %r9 |
# |
# Save RCX, the 4th argument, aside because RCX gets rewritten by the |
# SYSCALL instruction. |
# |
movq %rcx, %r10 |
syscall |
ret |
|
.end __syscall |