Commit | Line | Data |
---|---|---|
1965aae3 PA |
1 | #ifndef _ASM_X86_FTRACE_H |
2 | #define _ASM_X86_FTRACE_H | |
395a59d0 | 3 | |
d680fe44 CG |
4 | #ifdef __ASSEMBLY__ |
5 | ||
08f6fba5 SR |
6 | /* skip is set if the stack was already partially adjusted */ |
7 | .macro MCOUNT_SAVE_FRAME skip=0 | |
8 | /* | |
9 | * We add enough stack to save all regs. | |
10 | */ | |
11 | subq $(SS+8-\skip), %rsp | |
12 | movq %rax, RAX(%rsp) | |
13 | movq %rcx, RCX(%rsp) | |
14 | movq %rdx, RDX(%rsp) | |
15 | movq %rsi, RSI(%rsp) | |
16 | movq %rdi, RDI(%rsp) | |
17 | movq %r8, R8(%rsp) | |
18 | movq %r9, R9(%rsp) | |
19 | /* Move RIP to its proper location */ | |
20 | movq SS+8(%rsp), %rdx | |
21 | movq %rdx, RIP(%rsp) | |
d680fe44 CG |
22 | .endm |
23 | ||
08f6fba5 SR |
24 | .macro MCOUNT_RESTORE_FRAME skip=0 |
25 | movq R9(%rsp), %r9 | |
26 | movq R8(%rsp), %r8 | |
27 | movq RDI(%rsp), %rdi | |
28 | movq RSI(%rsp), %rsi | |
29 | movq RDX(%rsp), %rdx | |
30 | movq RCX(%rsp), %rcx | |
31 | movq RAX(%rsp), %rax | |
32 | addq $(SS+8-\skip), %rsp | |
d680fe44 CG |
33 | .endm |
34 | ||
35 | #endif | |
36 | ||
606576ce | 37 | #ifdef CONFIG_FUNCTION_TRACER |
395a59d0 AS |
38 | #define MCOUNT_ADDR ((long)(mcount)) |
39 | #define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */ | |
40 | ||
28fb5dfa | 41 | #ifdef CONFIG_DYNAMIC_FTRACE |
2f5f6ad9 | 42 | #define ARCH_SUPPORTS_FTRACE_OPS 1 |
08f6fba5 SR |
43 | #ifdef CONFIG_X86_64 |
44 | #define ARCH_SUPPORTS_FTRACE_SAVE_REGS | |
45 | #endif | |
2f5f6ad9 SR |
46 | #endif |
47 | ||
395a59d0 AS |
48 | #ifndef __ASSEMBLY__ |
49 | extern void mcount(void); | |
a192cd04 | 50 | extern atomic_t modifying_ftrace_code; |
68bf21aa SR |
51 | |
52 | static inline unsigned long ftrace_call_adjust(unsigned long addr) | |
53 | { | |
54 | /* | |
521ccb5c MS |
55 | * addr is the address of the mcount call instruction. |
56 | * recordmcount does the necessary offset calculation. | |
68bf21aa | 57 | */ |
521ccb5c | 58 | return addr; |
68bf21aa | 59 | } |
31e88909 SR |
60 | |
61 | #ifdef CONFIG_DYNAMIC_FTRACE | |
62 | ||
63 | struct dyn_arch_ftrace { | |
64 | /* No extra data needed for x86 */ | |
65 | }; | |
66 | ||
08d636b6 SR |
67 | int ftrace_int3_handler(struct pt_regs *regs); |
68 | ||
31e88909 | 69 | #endif /* CONFIG_DYNAMIC_FTRACE */ |
a26a2a27 | 70 | #endif /* __ASSEMBLY__ */ |
606576ce | 71 | #endif /* CONFIG_FUNCTION_TRACER */ |
395a59d0 | 72 | |
1965aae3 | 73 | #endif /* _ASM_X86_FTRACE_H */ |