syscall: linux-ppc64x (incorrectly?) treats R4 as a syscall return value #51192
Labels
arch-ppc64x
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
All of the linux-ppc64x Syscall functions return the contents of R4 as syscall return r2.
#42178 previously ran into issues because system calls were getting inconsistent r2 values. The short-term workaround there was to ignore r2 for AllThreadsSyscall, with the assumption that some syscalls may use r2.
On further investigation, it looks like that is not true.
The Linux ppc64 system call ABI documentation lists only R3 as a return value, with R4 getting clobbered.
The system call entrypoint I find a bit difficult to follow, as it is unclear exactly what function pointers are loaded by
__LOAD_HANDLER
, but not seeing lots of assembly implementations, I assume these are the C system call implementations.syscall_exit_prepare seems pretty clear that it only expects to use R3 for the return value.
Thus my conclusion is that R4 is never a syscall return value and our syscall implementations should change to unconditionally returning 0 for r2.
Anyone know if I missed something that should keep R4 in use?
cc @minux @cherrymui @aclements @AndrewGMorgan @laboger
The text was updated successfully, but these errors were encountered: