fix x86_64 syscall register (r10)

master
WangRunji 6 years ago
parent 408f23213d
commit 64dac11ac3

@ -87,8 +87,7 @@ static struct kinfo_t *kinfo;
// this macro to make sure the clobbers are coherent for these three pieces of
// code using syscalls.
#if defined(__x86_64__)
#define SYSCALL_CLOBBERS "cc", "memory", "r10", "r11", "r12", "r13", \
"r14", "r15"
#define SYSCALL_CLOBBERS "cc", "memory", "r11", "r12", "r13", "r14", "r15"
#elif defined(__aarch64__)
#define SYSCALL_CLOBBERS "cc", "memory"
#endif
@ -99,6 +98,7 @@ syscall6(long a1, long a2, long a3, long a4, long a5, long a6, long trap)
long ret;
#if defined(__x86_64__)
register long r10 asm("r10") = a4;
register long r8 asm("r8") = a5;
register long r9 asm("r9") = a6;
@ -109,7 +109,7 @@ syscall6(long a1, long a2, long a3, long a4, long a5, long a6, long trap)
"leaq 2(%%rip), %%r11\n"
"syscall\n"
: "=a"(ret)
: "0"(trap), "D"(a1), "S"(a2), "d"(a3), "c"(a4), "r"(r8), "r"(r9)
: "0"(trap), "D"(a1), "S"(a2), "d"(a3), "r"(r10), "r"(r8), "r"(r9)
: SYSCALL_CLOBBERS);
#elif defined(__aarch64__)
register long x8 asm("x8") = trap;

@ -19,7 +19,7 @@ fn sys_call(syscall_id: SyscallId, arg0: usize, arg1: usize, arg2: usize, arg3:
#[cfg(target_arch = "x86_64")]
asm!("syscall"
: "={rax}" (ret)
: "{rax}" (id), "{rdi}" (arg0), "{rsi}" (arg1), "{rdx}" (arg2), "{rcx}" (arg3), "{r8}" (arg4), "{r9}" (arg5)
: "{rax}" (id), "{rdi}" (arg0), "{rsi}" (arg1), "{rdx}" (arg2), "{r10}" (arg3), "{r8}" (arg4), "{r9}" (arg5)
: "memory"
: "intel" "volatile");
#[cfg(target_arch = "aarch64")]

Loading…
Cancel
Save