fix(syscall): pin r10/r8 for 4- and 5-argument syscalls

This commit is contained in:
2026-09-03 18:32:44 -04:00
parent 601e1fe960
commit 2480c63fbd
2 changed files with 65 additions and 2 deletions
+5 -2
View File
@@ -75,10 +75,11 @@ static inline long __attribute__((always_inline))
__syscall4(long n, long a, long b, long c, long d)
{
unsigned long ret;
register long r10 __asm__("r10") = d;
__asm__ volatile("syscall"
: "=a"(ret)
: "a"(n), "D"(a), "S"(b), "d"(c), "r"(d)
: "a"(n), "D"(a), "S"(b), "d"(c), "r"(r10)
: "rcx", "r11", "memory");
return (long)ret;
}
@@ -87,10 +88,12 @@ static inline long __attribute__((always_inline))
__syscall5(long n, long a, long b, long c, long d, long e)
{
unsigned long ret;
register long r10 __asm__("r10") = d;
register long r8 __asm__("r8") = e;
__asm__ volatile("syscall"
: "=a"(ret)
: "a"(n), "D"(a), "S"(b), "d"(c), "r"(d), "r"(e)
: "a"(n), "D"(a), "S"(b), "d"(c), "r"(r10), "r"(r8)
: "rcx", "r11", "memory");
return (long)ret;
}