Commit: 7731cc2627da2f49545f4a8b32a02cc2cf6540db
Parent: 33cc37bdd2ed039a9b551f93f53a8cd2ea70c8f9
Author: Randy Palamar
Date: Sat, 28 Dec 2024 13:34:23 -0700
amd64: fix incorrect register in syscall5
linux syscall register use on amd64 is a literal difficult to
follow. Its quite annoying that they based the entire linux
syscall calling convention on the x86/amd64 calling convention but
fortunately we avoid to useless movs on aarch64 by defining the
interface ourselves.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/platform_linux_amd64.c b/platform_linux_amd64.c
@@ -99,10 +99,10 @@ syscall5(i64 n, i64 a1, i64 a2, i64 a3, i64 a4, i64 a5)
{
i64 result;
register i64 r10 asm("r10") = a4;
- register i64 r9 asm("r9") = a5;
+ register i64 r8 asm("r8") = a5;
asm volatile ("syscall"
: "=a"(result)
- : "a"(n), "D"(a1), "S"(a2), "d"(a3), "r"(r10), "r"(r9)
+ : "a"(n), "D"(a1), "S"(a2), "d"(a3), "r"(r10), "r"(r8)
: "rcx", "r11", "memory"
);
return result;