common-user: Fix tail calls to safe_syscall_set_errno_tail

For the ABIs in which the syscall return register is not
also the first function argument register, move the errno
value into the correct place.

Fixes: a3310c0397 ("linux-user: Move syscall error detection into safe_syscall_base")
Reported-by: Laurent Vivier <laurent@vivier.eu>
Tested-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220104190454.542225-1-richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2022-01-04 11:00:35 -08:00
parent 9de225a1c2
commit d7478d4229
3 changed files with 3 additions and 0 deletions

View File

@ -120,6 +120,7 @@ safe_syscall_end:
pop %ebp
.cfi_adjust_cfa_offset -4
.cfi_restore ebp
mov %eax, (%esp)
jmp safe_syscall_set_errno_tail
.cfi_endproc

View File

@ -141,6 +141,7 @@ safe_syscall_end:
1: USE_ALT_CP(t0)
SETUP_GPX(t1)
SETUP_GPX64(t0, t1)
move a0, v0
PTR_LA t9, safe_syscall_set_errno_tail
jr t9

View File

@ -99,6 +99,7 @@ safe_syscall_end:
1: pop %rbp
.cfi_def_cfa_offset 8
.cfi_restore rbp
mov %eax, %edi
jmp safe_syscall_set_errno_tail
.cfi_endproc