diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2021-11-23 15:18:49 +0100 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2021-12-20 10:12:29 -0800 |
commit | 5bfd125ec8ba8aab04f3a636dcea39f6c4075ced (patch) | |
tree | 2b82a29e6883f6ec6866434f79979d46cfeeb399 /common-user/host/aarch64 | |
parent | bbf15aaf7c7506c88062288b3ae122b882f65e69 (diff) | |
download | qemu-5bfd125ec8ba8aab04f3a636dcea39f6c4075ced.zip qemu-5bfd125ec8ba8aab04f3a636dcea39f6c4075ced.tar.gz qemu-5bfd125ec8ba8aab04f3a636dcea39f6c4075ced.tar.bz2 |
common-user: Adjust system call return on FreeBSD
FreeBSD system calls return positive errno. On the 4 hosts for
which we have support, error is indicated by the C bit set or clear.
Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'common-user/host/aarch64')
-rw-r--r-- | common-user/host/aarch64/safe-syscall.inc.S | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/common-user/host/aarch64/safe-syscall.inc.S b/common-user/host/aarch64/safe-syscall.inc.S index 73a04b7..b8fd5b5 100644 --- a/common-user/host/aarch64/safe-syscall.inc.S +++ b/common-user/host/aarch64/safe-syscall.inc.S @@ -60,17 +60,29 @@ safe_syscall_start: cbnz w10, 2f svc 0x0 safe_syscall_end: + /* code path for having successfully executed the syscall */ +#if defined(__linux__) + /* Linux kernel returns (small) negative errno. */ cmp x0, #-4096 b.hi 0f +#elif defined(__FreeBSD__) + /* FreeBSD kernel returns positive errno and C bit set. */ + b.cs 1f +#else +#error "unsupported os" +#endif ret +#if defined(__linux__) /* code path setting errno */ 0: neg w0, w0 b safe_syscall_set_errno_tail +#endif /* code path when we didn't execute the syscall */ 2: mov w0, #QEMU_ERESTARTSYS - b safe_syscall_set_errno_tail +1: b safe_syscall_set_errno_tail + .cfi_endproc .size safe_syscall_base, .-safe_syscall_base |