diff options
Diffstat (limited to 'arch/x86/kernel/entry_64.S')
-rw-r--r-- | arch/x86/kernel/entry_64.S | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index 08aa6b10933c..2aa0526ac30e 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -98,6 +98,12 @@ ftrace_call: | |||
98 | movq (%rsp), %rax | 98 | movq (%rsp), %rax |
99 | addq $0x38, %rsp | 99 | addq $0x38, %rsp |
100 | 100 | ||
101 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
102 | .globl ftrace_graph_call | ||
103 | ftrace_graph_call: | ||
104 | jmp ftrace_stub | ||
105 | #endif | ||
106 | |||
101 | .globl ftrace_stub | 107 | .globl ftrace_stub |
102 | ftrace_stub: | 108 | ftrace_stub: |
103 | retq | 109 | retq |
@@ -110,6 +116,12 @@ ENTRY(mcount) | |||
110 | 116 | ||
111 | cmpq $ftrace_stub, ftrace_trace_function | 117 | cmpq $ftrace_stub, ftrace_trace_function |
112 | jnz trace | 118 | jnz trace |
119 | |||
120 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
121 | cmpq $ftrace_stub, ftrace_graph_return | ||
122 | jnz ftrace_graph_caller | ||
123 | #endif | ||
124 | |||
113 | .globl ftrace_stub | 125 | .globl ftrace_stub |
114 | ftrace_stub: | 126 | ftrace_stub: |
115 | retq | 127 | retq |
@@ -145,6 +157,68 @@ END(mcount) | |||
145 | #endif /* CONFIG_DYNAMIC_FTRACE */ | 157 | #endif /* CONFIG_DYNAMIC_FTRACE */ |
146 | #endif /* CONFIG_FUNCTION_TRACER */ | 158 | #endif /* CONFIG_FUNCTION_TRACER */ |
147 | 159 | ||
160 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
161 | ENTRY(ftrace_graph_caller) | ||
162 | cmpl $0, function_trace_stop | ||
163 | jne ftrace_stub | ||
164 | |||
165 | subq $0x38, %rsp | ||
166 | movq %rax, (%rsp) | ||
167 | movq %rcx, 8(%rsp) | ||
168 | movq %rdx, 16(%rsp) | ||
169 | movq %rsi, 24(%rsp) | ||
170 | movq %rdi, 32(%rsp) | ||
171 | movq %r8, 40(%rsp) | ||
172 | movq %r9, 48(%rsp) | ||
173 | |||
174 | leaq 8(%rbp), %rdi | ||
175 | movq 0x38(%rsp), %rsi | ||
176 | |||
177 | call prepare_ftrace_return | ||
178 | |||
179 | movq 48(%rsp), %r9 | ||
180 | movq 40(%rsp), %r8 | ||
181 | movq 32(%rsp), %rdi | ||
182 | movq 24(%rsp), %rsi | ||
183 | movq 16(%rsp), %rdx | ||
184 | movq 8(%rsp), %rcx | ||
185 | movq (%rsp), %rax | ||
186 | addq $0x38, %rsp | ||
187 | retq | ||
188 | END(ftrace_graph_caller) | ||
189 | |||
190 | |||
191 | .globl return_to_handler | ||
192 | return_to_handler: | ||
193 | subq $80, %rsp | ||
194 | |||
195 | movq %rax, (%rsp) | ||
196 | movq %rcx, 8(%rsp) | ||
197 | movq %rdx, 16(%rsp) | ||
198 | movq %rsi, 24(%rsp) | ||
199 | movq %rdi, 32(%rsp) | ||
200 | movq %r8, 40(%rsp) | ||
201 | movq %r9, 48(%rsp) | ||
202 | movq %r10, 56(%rsp) | ||
203 | movq %r11, 64(%rsp) | ||
204 | |||
205 | call ftrace_return_to_handler | ||
206 | |||
207 | movq %rax, 72(%rsp) | ||
208 | movq 64(%rsp), %r11 | ||
209 | movq 56(%rsp), %r10 | ||
210 | movq 48(%rsp), %r9 | ||
211 | movq 40(%rsp), %r8 | ||
212 | movq 32(%rsp), %rdi | ||
213 | movq 24(%rsp), %rsi | ||
214 | movq 16(%rsp), %rdx | ||
215 | movq 8(%rsp), %rcx | ||
216 | movq (%rsp), %rax | ||
217 | addq $72, %rsp | ||
218 | retq | ||
219 | #endif | ||
220 | |||
221 | |||
148 | #ifndef CONFIG_PREEMPT | 222 | #ifndef CONFIG_PREEMPT |
149 | #define retint_kernel retint_restore_args | 223 | #define retint_kernel retint_restore_args |
150 | #endif | 224 | #endif |