b3bb1f3f27734adde2a4aab21c32a8602b5ea878
[platform/adaptation/renesas_rcar/renesas_kernel.git] / arch / x86 / include / asm / ftrace.h
1 #ifndef _ASM_X86_FTRACE_H
2 #define _ASM_X86_FTRACE_H
3
4 #ifdef __ASSEMBLY__
5
6         .macro MCOUNT_SAVE_FRAME
7         /* taken from glibc */
8         subq $0x38, %rsp
9         movq %rax, (%rsp)
10         movq %rcx, 8(%rsp)
11         movq %rdx, 16(%rsp)
12         movq %rsi, 24(%rsp)
13         movq %rdi, 32(%rsp)
14         movq %r8, 40(%rsp)
15         movq %r9, 48(%rsp)
16         .endm
17
18         .macro MCOUNT_RESTORE_FRAME
19         movq 48(%rsp), %r9
20         movq 40(%rsp), %r8
21         movq 32(%rsp), %rdi
22         movq 24(%rsp), %rsi
23         movq 16(%rsp), %rdx
24         movq 8(%rsp), %rcx
25         movq (%rsp), %rax
26         addq $0x38, %rsp
27         .endm
28
29 #endif
30
31 #ifdef CONFIG_FUNCTION_TRACER
32 #define MCOUNT_ADDR             ((long)(mcount))
33 #define MCOUNT_INSN_SIZE        5 /* sizeof mcount call */
34
35 #ifdef CONFIG_DYNAMIC_FTRACE
36 #define ARCH_SUPPORTS_FTRACE_OPS 1
37 #endif
38
39 #ifndef __ASSEMBLY__
40 extern void mcount(void);
41 extern atomic_t modifying_ftrace_code;
42
43 static inline unsigned long ftrace_call_adjust(unsigned long addr)
44 {
45         /*
46          * addr is the address of the mcount call instruction.
47          * recordmcount does the necessary offset calculation.
48          */
49         return addr;
50 }
51
52 #ifdef CONFIG_DYNAMIC_FTRACE
53
54 struct dyn_arch_ftrace {
55         /* No extra data needed for x86 */
56 };
57
58 int ftrace_int3_handler(struct pt_regs *regs);
59
60 #endif /*  CONFIG_DYNAMIC_FTRACE */
61 #endif /* __ASSEMBLY__ */
62 #endif /* CONFIG_FUNCTION_TRACER */
63
64 #endif /* _ASM_X86_FTRACE_H */