Commit
76d5701c19b0 ("lib/syscall_shim: Save `struct uk_syscall_ctx` on binary syscalls")
placed the `1:` label to be used by binary system calls to avoid
subtracting the register frame size that would normally be done during
the handling of other trap types and instead use the per-thread auxiliary
stack from which `UK_SYSCALL_CTX_SIZE` was already previously subtracted.
However, this label placement skips restoration of `x0` which was
originally stored in the `TPIDRRO_EL0` system register.
Fix this by always restoring the `x0` register on both paths: binary
system call traps and other traps.
Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1256
str x0, [sp, #__SP_OFFSET] /* Store old SP in auxiliary stack */
b 1f
0:
- /* Restore x0 */
- mrs x0, tpidrro_el0
-
sub sp, sp, #__TRAP_STACK_SIZE
1:
+ /* Restore x0 */
+ mrs x0, tpidrro_el0
/* Save general purpose registers */
stp x0, x1, [sp, #16 * 0]