ftrace.h 1.8 KB
Newer Older
1
/* SPDX-License-Identifier: GPL-2.0 */
H
H. Peter Anvin 已提交
2 3
#ifndef _ASM_X86_FTRACE_H
#define _ASM_X86_FTRACE_H
4

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
11
#endif
12 13
#define MCOUNT_INSN_SIZE	5 /* sizeof mcount call */

14
#ifdef CONFIG_DYNAMIC_FTRACE
15
#define ARCH_SUPPORTS_FTRACE_OPS 1
16
#endif
17

18 19
#define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR

20 21
#ifndef __ASSEMBLY__
extern void mcount(void);
22
extern atomic_t modifying_ftrace_code;
23
extern void __fentry__(void);
24 25 26 27

static inline unsigned long ftrace_call_adjust(unsigned long addr)
{
	/*
28 29
	 * addr is the address of the mcount call instruction.
	 * recordmcount does the necessary offset calculation.
30
	 */
31
	return addr;
32
}
33 34 35 36 37 38 39

#ifdef CONFIG_DYNAMIC_FTRACE

struct dyn_arch_ftrace {
	/* No extra data needed for x86 */
};

40 41
int ftrace_int3_handler(struct pt_regs *regs);

42 43
#define FTRACE_GRAPH_TRAMP_ADDR FTRACE_GRAPH_ADDR

44
#endif /*  CONFIG_DYNAMIC_FTRACE */
S
Steven Rostedt 已提交
45
#endif /* __ASSEMBLY__ */
46
#endif /* CONFIG_FUNCTION_TRACER */
47

48 49 50 51

#if !defined(__ASSEMBLY__) && !defined(COMPILE_OFFSETS)

#if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_IA32_EMULATION)
52
#include <linux/compat.h>
53 54 55 56 57 58

/*
 * Because ia32 syscalls do not map to x86_64 syscall numbers
 * this screws up the trace output when tracing a ia32 task.
 * Instead of reporting bogus syscalls, just do not trace them.
 *
59
 * If the user really wants these, then they should use the
60 61 62 63 64
 * raw syscall tracepoints with filtering.
 */
#define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS 1
static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs)
{
65
	if (in_compat_syscall())
66 67 68 69 70 71
		return true;
	return false;
}
#endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_IA32_EMULATION */
#endif /* !__ASSEMBLY__  && !COMPILE_OFFSETS */

H
H. Peter Anvin 已提交
72
#endif /* _ASM_X86_FTRACE_H */