mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[kernel] Allow for more than three syscall args
The rcx register is used by the function call ABI for the 4th argument, but is also clobbered by SYSCALL to hold the IP. The r10 register is caller-saved but not part of the ABI, so stash rcx there when crossing the syscall boundary.
This commit is contained in:
@@ -23,9 +23,11 @@ syscall_handler_prelude:
|
|||||||
mov rbp, rsp
|
mov rbp, rsp
|
||||||
|
|
||||||
; account for the hole in the sysv abi
|
; account for the hole in the sysv abi
|
||||||
; argument list since SYSCALL uses rcx
|
; argument list since SYSCALL uses rcx.
|
||||||
mov rcx, r8
|
; r10 is non-preserved but not part of
|
||||||
mov r8, r9
|
; the function call ABI, so the rcx arg
|
||||||
|
; was stashed there.
|
||||||
|
mov rcx, r10
|
||||||
|
|
||||||
push rbx
|
push rbx
|
||||||
push r11
|
push r11
|
||||||
|
|||||||
@@ -5,9 +5,10 @@
|
|||||||
mov rbp, rsp
|
mov rbp, rsp
|
||||||
|
|
||||||
; args should already be in rdi, etc, but rcx will
|
; args should already be in rdi, etc, but rcx will
|
||||||
; get stomped, so shift args out one spot from rcx
|
; get stomped, so stash it in r10, which isn't a
|
||||||
mov r9, r8
|
; callee-saved register, but also isn't used in the
|
||||||
mov r8, rcx
|
; function call ABI.
|
||||||
|
mov r10, rcx
|
||||||
|
|
||||||
mov rax, %2
|
mov rax, %2
|
||||||
syscall
|
syscall
|
||||||
|
|||||||
Reference in New Issue
Block a user