On 11/8/21 3:37 AM, Warner Losh wrote:
All the *-users generally use the Linux style of negative return codes
for errno. However, other systems, like FreeBSD, have a different
convention. Allow those systems to insert code after the syscall that
adjusts the return value of the system call to match the native linux
format.

Signed-off-by: Warner Losh <i...@bsdimp.com>
---
  common-user/host/aarch64/safe-syscall.inc.S | 1 +
  common-user/host/arm/safe-syscall.inc.S     | 1 +
  common-user/host/i386/safe-syscall.inc.S    | 1 +
  common-user/host/ppc64/safe-syscall.inc.S   | 1 +
  common-user/host/riscv/safe-syscall.inc.S   | 1 +
  common-user/host/s390x/safe-syscall.inc.S   | 1 +
  common-user/host/x86_64/safe-syscall.inc.S  | 1 +
  linux-user/safe-syscall.S                   | 1 +
  8 files changed, 8 insertions(+)

diff --git a/common-user/host/aarch64/safe-syscall.inc.S 
b/common-user/host/aarch64/safe-syscall.inc.S
index bc1f5a9792..81d83e8e79 100644
--- a/common-user/host/aarch64/safe-syscall.inc.S
+++ b/common-user/host/aarch64/safe-syscall.inc.S
@@ -64,6 +64,7 @@ safe_syscall_start:
        svc     0x0
  safe_syscall_end:
        /* code path for having successfully executed the syscall */
+       ADJUST_SYSCALL_RETCODE
        ret
0:

Not sure about this, really. Is it really that much cleaner to insert this than create separate 10-line files, with the adjustment included?


r~

Reply via email to