1 year ago
#344505
Arget
What registers do the linux kernel clobber on aarch64 during a syscall
Every resource I have found about the aarch64 ABI over Linux mentions that x8
holds the syscall number and that the arguments go in registers x0
through x5
. They also note that this registers are caller-saved (including also x6
and x7
) when calling subroutines (with x0
used for the returned value), but they never clarify if the kernel may or may not clobber any register apart from x0
. Or maybe it isn't even the kernel, like the case with rcx
and r11
in x86_64.
The syscall manpage doesn't help much:
Note that these tables don't cover the entire calling convention —some architectures may indiscriminately clobber other registers not listed here.
Well, in that same document x1
is shown as a 2nd returned value, but in x86_64 rdx
is also shown as so, and, having a lot of experience with this ISA, I have never seen a syscall return anything in or clobber rdx
.
Anyway, what I have seen so far (and I have very little experience with ARM/ARM64) is that the only clobbered register is x0.
linux
system-calls
arm64
abi
0 Answers
Your Answer