]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
common-user: Fix tail calls to safe_syscall_set_errno_tail
authorRichard Henderson <richard.henderson@linaro.org>
Tue, 4 Jan 2022 19:00:35 +0000 (11:00 -0800)
committerRichard Henderson <richard.henderson@linaro.org>
Tue, 4 Jan 2022 23:41:03 +0000 (15:41 -0800)
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: a3310c0397e2 ("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>

common-user/host/i386/safe-syscall.inc.S
common-user/host/mips/safe-syscall.inc.S
common-user/host/x86_64/safe-syscall.inc.S

index baf5400a29ce44e41d5fb56c39ee6a393b38b783..9c45e56e48072be9812593ff747132b265d8530e 100644 (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
index fc75a337d1620431ca385f9da1f43feacfa27d6e..6a446149704e42af5d8626acbc3d9ce2a1d7fde9 100644 (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
 
index a20927a78386f307d60ab48637f82432599f3b71..d1a67a303a9f3e021f536e6a7d73ccd16d79cd18 100644 (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