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 <i...@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