[PULL 06/21] linux-user: move user/syscall-trace.h to linux-user/syscall.c

Pierrick Bouvier posted 21 patches 1 week, 5 days ago
Maintainers: Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>, "Alex Bennée" <alex.bennee@linaro.org>, Pierrick Bouvier <pierrick.bouvier@linaro.org>, Alexandre Iooss <erdnaxe@crans.org>, Mahmoud Mandour <ma.mandourr@gmail.com>, Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Laurent Vivier <laurent@vivier.eu>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Kostiantyn Kostiuk <kkostiuk@redhat.com>, Michael Roth <michael.roth@amd.com>
[PULL 06/21] linux-user: move user/syscall-trace.h to linux-user/syscall.c
Posted by Pierrick Bouvier 1 week, 5 days ago
For now, only linux-user supports plugin syscall API, so restrict the
scope of these functions to linux-user/syscall.c

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260129013134.3956938-7-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 include/user/syscall-trace.h  | 43 -----------------------------------
 bsd-user/freebsd/os-syscall.c |  1 -
 linux-user/syscall.c          | 20 +++++++++++++++-
 3 files changed, 19 insertions(+), 45 deletions(-)
 delete mode 100644 include/user/syscall-trace.h

diff --git a/include/user/syscall-trace.h b/include/user/syscall-trace.h
deleted file mode 100644
index 9bd7ca19c84..00000000000
--- a/include/user/syscall-trace.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Common System Call Tracing Wrappers for *-user
- *
- * Copyright (c) 2019 Linaro
- * Written by Alex Bennée <alex.bennee@linaro.org>
- *
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-#ifndef SYSCALL_TRACE_H
-#define SYSCALL_TRACE_H
-
-#include "user/abitypes.h"
-#include "gdbstub/user.h"
-#include "qemu/plugin.h"
-#include "trace/trace-root.h"
-
-/*
- * These helpers just provide a common place for the various
- * subsystems that want to track syscalls to put their hooks in. We
- * could potentially unify the -strace code here as well.
- */
-
-static inline void record_syscall_start(CPUState *cpu, int num,
-                                        abi_long arg1, abi_long arg2,
-                                        abi_long arg3, abi_long arg4,
-                                        abi_long arg5, abi_long arg6,
-                                        abi_long arg7, abi_long arg8)
-{
-    qemu_plugin_vcpu_syscall(cpu, num,
-                             arg1, arg2, arg3, arg4,
-                             arg5, arg6, arg7, arg8);
-    gdb_syscall_entry(cpu, num);
-}
-
-static inline void record_syscall_return(CPUState *cpu, int num, abi_long ret)
-{
-    qemu_plugin_vcpu_syscall_ret(cpu, num, ret);
-    gdb_syscall_return(cpu, num);
-}
-
-
-#endif /* SYSCALL_TRACE_H */
diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c
index ca2f6fdb66e..4c1191b8f47 100644
--- a/bsd-user/freebsd/os-syscall.c
+++ b/bsd-user/freebsd/os-syscall.c
@@ -31,7 +31,6 @@
 
 #include "qemu.h"
 #include "signal-common.h"
-#include "user/syscall-trace.h"
 
 /* BSD independent syscall shims */
 #include "bsd-file.h"
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 3944004568f..b4b551ad148 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -132,6 +132,7 @@
 #include "uname.h"
 
 #include "qemu.h"
+#include "gdbstub/user.h"
 #include "user-internals.h"
 #include "strace.h"
 #include "signal-common.h"
@@ -142,7 +143,6 @@
 #include "user/signal.h"
 #include "qemu/guest-random.h"
 #include "qemu/selfmap.h"
-#include "user/syscall-trace.h"
 #include "special-errno.h"
 #include "qapi/error.h"
 #include "fd-trans.h"
@@ -14334,6 +14334,24 @@ static bool sys_dispatch(CPUState *cpu, TaskState *ts)
     return true;
 }
 
+static void record_syscall_start(CPUState *cpu, int num,
+                                 abi_long arg1, abi_long arg2,
+                                 abi_long arg3, abi_long arg4,
+                                 abi_long arg5, abi_long arg6,
+                                 abi_long arg7, abi_long arg8)
+{
+    qemu_plugin_vcpu_syscall(cpu, num,
+                             arg1, arg2, arg3, arg4,
+                             arg5, arg6, arg7, arg8);
+    gdb_syscall_entry(cpu, num);
+}
+
+static void record_syscall_return(CPUState *cpu, int num, abi_long ret)
+{
+    qemu_plugin_vcpu_syscall_ret(cpu, num, ret);
+    gdb_syscall_return(cpu, num);
+}
+
 abi_long do_syscall(CPUArchState *cpu_env, int num, abi_long arg1,
                     abi_long arg2, abi_long arg3, abi_long arg4,
                     abi_long arg5, abi_long arg6, abi_long arg7,
-- 
2.47.3