linux-user: Move syscall error detection into safe_syscall_base

The current api from safe_syscall_base() is to return -errno, which is
the interface provided by *some* linux kernel abis.  The wrapper macro,
safe_syscall(), detects error, stores into errno, and returns -1, to
match the api of the system syscall().

For those kernel abis that do not return -errno natively, this leads
to double syscall error detection.  E.g. Linux ppc64, which sets the
SO flag for error.

Simplify the usage from C by moving the error detection into assembly,
and usage from assembly by providing a C helper with which to set errno.

Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2021-11-15 14:08:52 +01:00
parent b9d2af3c62
commit a3310c0397
10 changed files with 147 additions and 87 deletions

View file

@ -10,6 +10,7 @@ linux_user_ss.add(files(
'main.c',
'mmap.c',
'safe-syscall.S',
'safe-syscall-error.c',
'signal.c',
'strace.c',
'syscall.c',