qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 16/22] bsd-user/freebsd/os-syscall.c: Tracing and error boile


From: Richard Henderson
Subject: Re: [PATCH 16/22] bsd-user/freebsd/os-syscall.c: Tracing and error boilerplate
Date: Wed, 2 Feb 2022 08:31:11 +1100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

On 2/1/22 22:14, Warner Losh wrote:
Add in the tracing and this system call not implemented boilerplate.

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
  bsd-user/freebsd/os-syscall.c | 27 ++++++++++++++++++++++++++-
  1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c
index d49945f0fcc..fcfa6221182 100644
--- a/bsd-user/freebsd/os-syscall.c
+++ b/bsd-user/freebsd/os-syscall.c
@@ -200,7 +200,32 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, 
abi_long arg1,
                              abi_long arg5, abi_long arg6, abi_long arg7,
                              abi_long arg8)
  {
-    return 0;
+    CPUState *cpu = env_cpu(cpu_env);
+    abi_long ret;
+
+#ifdef DEBUG
+    gemu_log("freebsd syscall %d\n", num);
+#endif
+    trace_guest_user_syscall(cpu, num, arg1, arg2, arg3, arg4, arg5, arg6, 
arg7, arg8);
+    if (do_strace) {
+        print_freebsd_syscall(num, arg1, arg2, arg3, arg4, arg5, arg6);
+    }
+
+    switch (num) {
+    default:
+        gemu_log("qemu: unsupported syscall: %d\n", num);
+        ret = -TARGET_ENOSYS;
+        break;
+    }
+
+#ifdef DEBUG
+    gemu_log(" = %ld\n", ret);
+#endif
+    if (do_strace) {
+        print_freebsd_syscall_ret(num, ret);
+    }
+    trace_guest_user_syscall_ret(cpu, num, ret);
+    return ret;
  }

I think it's simpler to put the logging in a wrapper function, so that one can return from the switch rather than be required to break.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]