diff options
Diffstat (limited to 'arch/s390/kernel/ftrace.c')
-rw-r--r-- | arch/s390/kernel/ftrace.c | 75 |
1 files changed, 1 insertions, 74 deletions
diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c index f5fe34dd821b..6a83d0581317 100644 --- a/arch/s390/kernel/ftrace.c +++ b/arch/s390/kernel/ftrace.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <trace/syscall.h> | 15 | #include <trace/syscall.h> |
16 | #include <asm/lowcore.h> | 16 | #include <asm/asm-offsets.h> |
17 | 17 | ||
18 | #ifdef CONFIG_DYNAMIC_FTRACE | 18 | #ifdef CONFIG_DYNAMIC_FTRACE |
19 | 19 | ||
@@ -200,76 +200,3 @@ out: | |||
200 | return parent; | 200 | return parent; |
201 | } | 201 | } |
202 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ | 202 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |
203 | |||
204 | #ifdef CONFIG_FTRACE_SYSCALLS | ||
205 | |||
206 | extern unsigned long __start_syscalls_metadata[]; | ||
207 | extern unsigned long __stop_syscalls_metadata[]; | ||
208 | extern unsigned int sys_call_table[]; | ||
209 | |||
210 | static struct syscall_metadata **syscalls_metadata; | ||
211 | |||
212 | struct syscall_metadata *syscall_nr_to_meta(int nr) | ||
213 | { | ||
214 | if (!syscalls_metadata || nr >= NR_syscalls || nr < 0) | ||
215 | return NULL; | ||
216 | |||
217 | return syscalls_metadata[nr]; | ||
218 | } | ||
219 | |||
220 | int syscall_name_to_nr(char *name) | ||
221 | { | ||
222 | int i; | ||
223 | |||
224 | if (!syscalls_metadata) | ||
225 | return -1; | ||
226 | for (i = 0; i < NR_syscalls; i++) | ||
227 | if (syscalls_metadata[i]) | ||
228 | if (!strcmp(syscalls_metadata[i]->name, name)) | ||
229 | return i; | ||
230 | return -1; | ||
231 | } | ||
232 | |||
233 | void set_syscall_enter_id(int num, int id) | ||
234 | { | ||
235 | syscalls_metadata[num]->enter_id = id; | ||
236 | } | ||
237 | |||
238 | void set_syscall_exit_id(int num, int id) | ||
239 | { | ||
240 | syscalls_metadata[num]->exit_id = id; | ||
241 | } | ||
242 | |||
243 | static struct syscall_metadata *find_syscall_meta(unsigned long syscall) | ||
244 | { | ||
245 | struct syscall_metadata *start; | ||
246 | struct syscall_metadata *stop; | ||
247 | char str[KSYM_SYMBOL_LEN]; | ||
248 | |||
249 | start = (struct syscall_metadata *)__start_syscalls_metadata; | ||
250 | stop = (struct syscall_metadata *)__stop_syscalls_metadata; | ||
251 | kallsyms_lookup(syscall, NULL, NULL, NULL, str); | ||
252 | |||
253 | for ( ; start < stop; start++) { | ||
254 | if (start->name && !strcmp(start->name + 3, str + 3)) | ||
255 | return start; | ||
256 | } | ||
257 | return NULL; | ||
258 | } | ||
259 | |||
260 | static int __init arch_init_ftrace_syscalls(void) | ||
261 | { | ||
262 | struct syscall_metadata *meta; | ||
263 | int i; | ||
264 | syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * NR_syscalls, | ||
265 | GFP_KERNEL); | ||
266 | if (!syscalls_metadata) | ||
267 | return -ENOMEM; | ||
268 | for (i = 0; i < NR_syscalls; i++) { | ||
269 | meta = find_syscall_meta((unsigned long)sys_call_table[i]); | ||
270 | syscalls_metadata[i] = meta; | ||
271 | } | ||
272 | return 0; | ||
273 | } | ||
274 | arch_initcall(arch_init_ftrace_syscalls); | ||
275 | #endif | ||