@@ -10,15 +10,15 @@ ; void k_platform_syscall_raw(s64* result, u64* errno, ; syscall, u8 valency, s64[] args) bits 64 -%include "../arch/posix/x86.lin.64.s" -%include "../arch/x86.cdecl.64.s" +%include "arch/posix/x86.lin.64.s" +%include "arch/x86.cdecl.64.s" ; vim: ft=nasm %macro handle_arg 1 %assign v %1+1 - mov sys.reg. %+ v, [ccall.reg.4 + 8 * %1] + mov sys.reg. %+ v, [r15 + 8 * %1] dec ccall.reg.3 jz .perform_call %endmacro @@ -41,8 +41,15 @@ ; this needs to go before the loop ; or it'll get clobbered mov sys.reg.0, ccall.reg.2 + + ; the fourth argument is in %r8, which + ; is also a syscall register, so we + ; need to move it to a safe register + ; to keep it from getting clobbered + ; before we begin the "loop" + mov r15, ccall.reg.4 ; automatically generate the code ; needed to move the arguments into ; their correct registers. see above