.. | .. |
---|
3 | 3 | #define _ASM_X86_FTRACE_H |
---|
4 | 4 | |
---|
5 | 5 | #ifdef CONFIG_FUNCTION_TRACER |
---|
6 | | -#ifdef CC_USING_FENTRY |
---|
7 | | -# define MCOUNT_ADDR ((unsigned long)(__fentry__)) |
---|
8 | | -#else |
---|
9 | | -# define MCOUNT_ADDR ((unsigned long)(mcount)) |
---|
10 | | -# define HAVE_FUNCTION_GRAPH_FP_TEST |
---|
| 6 | +#ifndef CC_USING_FENTRY |
---|
| 7 | +# error Compiler does not support fentry? |
---|
11 | 8 | #endif |
---|
| 9 | +# define MCOUNT_ADDR ((unsigned long)(__fentry__)) |
---|
12 | 10 | #define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */ |
---|
13 | 11 | |
---|
14 | 12 | #ifdef CONFIG_DYNAMIC_FTRACE |
---|
.. | .. |
---|
18 | 16 | #define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR |
---|
19 | 17 | |
---|
20 | 18 | #ifndef __ASSEMBLY__ |
---|
21 | | -extern void mcount(void); |
---|
22 | 19 | extern atomic_t modifying_ftrace_code; |
---|
23 | 20 | extern void __fentry__(void); |
---|
24 | 21 | |
---|
.. | .. |
---|
31 | 28 | return addr; |
---|
32 | 29 | } |
---|
33 | 30 | |
---|
| 31 | +/* |
---|
| 32 | + * When a ftrace registered caller is tracing a function that is |
---|
| 33 | + * also set by a register_ftrace_direct() call, it needs to be |
---|
| 34 | + * differentiated in the ftrace_caller trampoline. To do this, we |
---|
| 35 | + * place the direct caller in the ORIG_AX part of pt_regs. This |
---|
| 36 | + * tells the ftrace_caller that there's a direct caller. |
---|
| 37 | + */ |
---|
| 38 | +static inline void arch_ftrace_set_direct_caller(struct pt_regs *regs, unsigned long addr) |
---|
| 39 | +{ |
---|
| 40 | + /* Emulate a call */ |
---|
| 41 | + regs->orig_ax = addr; |
---|
| 42 | +} |
---|
| 43 | + |
---|
34 | 44 | #ifdef CONFIG_DYNAMIC_FTRACE |
---|
35 | 45 | |
---|
36 | 46 | struct dyn_arch_ftrace { |
---|
37 | 47 | /* No extra data needed for x86 */ |
---|
38 | 48 | }; |
---|
39 | | - |
---|
40 | | -int ftrace_int3_handler(struct pt_regs *regs); |
---|
41 | 49 | |
---|
42 | 50 | #define FTRACE_GRAPH_TRAMP_ADDR FTRACE_GRAPH_ADDR |
---|
43 | 51 | |
---|
.. | .. |
---|
48 | 56 | |
---|
49 | 57 | #ifndef __ASSEMBLY__ |
---|
50 | 58 | |
---|
| 59 | +#if defined(CONFIG_FUNCTION_TRACER) && defined(CONFIG_DYNAMIC_FTRACE) |
---|
| 60 | +extern void set_ftrace_ops_ro(void); |
---|
| 61 | +#else |
---|
| 62 | +static inline void set_ftrace_ops_ro(void) { } |
---|
| 63 | +#endif |
---|
| 64 | + |
---|
51 | 65 | #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME |
---|
52 | 66 | static inline bool arch_syscall_match_sym_name(const char *sym, const char *name) |
---|
53 | 67 | { |
---|
54 | 68 | /* |
---|
55 | 69 | * Compare the symbol name with the system call name. Skip the |
---|
56 | | - * "__x64_sys", "__ia32_sys" or simple "sys" prefix. |
---|
| 70 | + * "__x64_sys", "__ia32_sys", "__do_sys" or simple "sys" prefix. |
---|
57 | 71 | */ |
---|
58 | 72 | return !strcmp(sym + 3, name + 3) || |
---|
59 | 73 | (!strncmp(sym, "__x64_", 6) && !strcmp(sym + 9, name + 3)) || |
---|
60 | | - (!strncmp(sym, "__ia32_", 7) && !strcmp(sym + 10, name + 3)); |
---|
| 74 | + (!strncmp(sym, "__ia32_", 7) && !strcmp(sym + 10, name + 3)) || |
---|
| 75 | + (!strncmp(sym, "__do_sys", 8) && !strcmp(sym + 8, name + 3)); |
---|
61 | 76 | } |
---|
62 | 77 | |
---|
63 | 78 | #ifndef COMPILE_OFFSETS |
---|
.. | .. |
---|
76 | 91 | #define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS 1 |
---|
77 | 92 | static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs) |
---|
78 | 93 | { |
---|
79 | | - if (in_compat_syscall()) |
---|
80 | | - return true; |
---|
81 | | - return false; |
---|
| 94 | + return in_32bit_syscall(); |
---|
82 | 95 | } |
---|
83 | 96 | #endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_IA32_EMULATION */ |
---|
84 | 97 | #endif /* !COMPILE_OFFSETS */ |
---|