aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-12-11 01:25:41 -0500
committerPaul Mundt <lethal@linux-sh.org>2009-12-11 01:25:41 -0500
commitd580cd96c8ee0c2647b810a2a8762cf631a5f97b (patch)
treebe5bd2bc03131f97f00cfa822afee79ddd59a868 /arch
parentb5c00a3a412857d6f07970984068c450429e051c (diff)
sh: ftrace: Fix up syscall tracing build.
Syscall tracing metadata was shuffled around, update accordingly. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/sh/kernel/ftrace.c76
1 files changed, 2 insertions, 74 deletions
diff --git a/arch/sh/kernel/ftrace.c b/arch/sh/kernel/ftrace.c
index b6f41c109beb..a48cdedc73b5 100644
--- a/arch/sh/kernel/ftrace.c
+++ b/arch/sh/kernel/ftrace.c
@@ -401,82 +401,10 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
401#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 401#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
402 402
403#ifdef CONFIG_FTRACE_SYSCALLS 403#ifdef CONFIG_FTRACE_SYSCALLS
404
405extern unsigned long __start_syscalls_metadata[];
406extern unsigned long __stop_syscalls_metadata[];
407extern unsigned long *sys_call_table; 404extern unsigned long *sys_call_table;
408 405
409static struct syscall_metadata **syscalls_metadata; 406unsigned long __init arch_syscall_addr(int nr)
410
411static struct syscall_metadata *find_syscall_meta(unsigned long *syscall)
412{
413 struct syscall_metadata *start;
414 struct syscall_metadata *stop;
415 char str[KSYM_SYMBOL_LEN];
416
417
418 start = (struct syscall_metadata *)__start_syscalls_metadata;
419 stop = (struct syscall_metadata *)__stop_syscalls_metadata;
420 kallsyms_lookup((unsigned long) syscall, NULL, NULL, NULL, str);
421
422 for ( ; start < stop; start++) {
423 if (start->name && !strcmp(start->name, str))
424 return start;
425 }
426
427 return NULL;
428}
429
430struct syscall_metadata *syscall_nr_to_meta(int nr)
431{
432 if (!syscalls_metadata || nr >= FTRACE_SYSCALL_MAX || nr < 0)
433 return NULL;
434
435 return syscalls_metadata[nr];
436}
437
438int syscall_name_to_nr(char *name)
439{
440 int i;
441
442 if (!syscalls_metadata)
443 return -1;
444 for (i = 0; i < NR_syscalls; i++)
445 if (syscalls_metadata[i])
446 if (!strcmp(syscalls_metadata[i]->name, name))
447 return i;
448 return -1;
449}
450
451void set_syscall_enter_id(int num, int id)
452{
453 syscalls_metadata[num]->enter_id = id;
454}
455
456void set_syscall_exit_id(int num, int id)
457{
458 syscalls_metadata[num]->exit_id = id;
459}
460
461static int __init arch_init_ftrace_syscalls(void)
462{ 407{
463 int i; 408 return (unsigned long)sys_call_table[nr];
464 struct syscall_metadata *meta;
465 unsigned long **psys_syscall_table = &sys_call_table;
466
467 syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) *
468 FTRACE_SYSCALL_MAX, GFP_KERNEL);
469 if (!syscalls_metadata) {
470 WARN_ON(1);
471 return -ENOMEM;
472 }
473
474 for (i = 0; i < FTRACE_SYSCALL_MAX; i++) {
475 meta = find_syscall_meta(psys_syscall_table[i]);
476 syscalls_metadata[i] = meta;
477 }
478
479 return 0;
480} 409}
481arch_initcall(arch_init_ftrace_syscalls);
482#endif /* CONFIG_FTRACE_SYSCALLS */ 410#endif /* CONFIG_FTRACE_SYSCALLS */