ftrace.h 1.7 KB
Newer Older
H
H. Peter Anvin 已提交
1 2
#ifndef _ASM_X86_FTRACE_H
#define _ASM_X86_FTRACE_H
3

4
#ifdef CONFIG_FUNCTION_TRACER
5
#ifdef CC_USING_FENTRY
6
# define MCOUNT_ADDR		((unsigned long)(__fentry__))
7
#else
8
# define MCOUNT_ADDR		((unsigned long)(mcount))
9
#endif
10 11
#define MCOUNT_INSN_SIZE	5 /* sizeof mcount call */

12
#ifdef CONFIG_DYNAMIC_FTRACE
13
#define ARCH_SUPPORTS_FTRACE_OPS 1
14
#endif
15

16 17
#ifndef __ASSEMBLY__
extern void mcount(void);
18
extern atomic_t modifying_ftrace_code;
19
extern void __fentry__(void);
20 21 22 23

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

#ifdef CONFIG_DYNAMIC_FTRACE

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

36 37
int ftrace_int3_handler(struct pt_regs *regs);

38 39
#define FTRACE_GRAPH_TRAMP_ADDR FTRACE_GRAPH_ADDR

40
#endif /*  CONFIG_DYNAMIC_FTRACE */
S
Steven Rostedt 已提交
41
#endif /* __ASSEMBLY__ */
42
#endif /* CONFIG_FUNCTION_TRACER */
43

44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60

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

#if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_IA32_EMULATION)
#include <asm/compat.h>

/*
 * 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.
 *
 * If the user realy wants these, then they should use the
 * raw syscall tracepoints with filtering.
 */
#define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS 1
static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs)
{
61
	if (in_compat_syscall())
62 63 64 65 66 67
		return true;
	return false;
}
#endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_IA32_EMULATION */
#endif /* !__ASSEMBLY__  && !COMPILE_OFFSETS */

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