xref: /qemu/include/user/syscall-trace.h (revision 29b62a10)
1 /*
2  * Common System Call Tracing Wrappers for *-user
3  *
4  * Copyright (c) 2019 Linaro
5  * Written by Alex Bennée <alex.bennee@linaro.org>
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9 
10 #ifndef SYSCALL_TRACE_H
11 #define SYSCALL_TRACE_H
12 
13 #include "exec/user/abitypes.h"
14 #include "trace/trace-root.h"
15 
16 /*
17  * These helpers just provide a common place for the various
18  * subsystems that want to track syscalls to put their hooks in. We
19  * could potentially unify the -strace code here as well.
20  */
21 
22 static inline void record_syscall_start(void *cpu, int num,
23                                         abi_long arg1, abi_long arg2,
24                                         abi_long arg3, abi_long arg4,
25                                         abi_long arg5, abi_long arg6,
26                                         abi_long arg7, abi_long arg8)
27 {
28     trace_guest_user_syscall(cpu, num,
29                              arg1, arg2, arg3, arg4,
30                              arg5, arg6, arg7, arg8);
31     qemu_plugin_vcpu_syscall(cpu, num,
32                              arg1, arg2, arg3, arg4,
33                              arg5, arg6, arg7, arg8);
34 }
35 
36 static inline void record_syscall_return(void *cpu, int num, abi_long ret)
37 {
38     trace_guest_user_syscall_ret(cpu, num, ret);
39     qemu_plugin_vcpu_syscall_ret(cpu, num, ret);
40 }
41 
42 
43 #endif /* SYSCALL_TRACE_H */
44