mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-06 14:48:06 +00:00
sh: ftrace: Fix up syscall tracepoint support.
Sync up with latest core changes in the syscalls tracing area: - tracing: Map syscall name to number (syscall_name_to_nr()) - tracing: Call arch_init_ftrace_syscalls at boot - tracing: add support tracepoint ids (set_syscall_{enter,exit}_id()) Taken from the s390 change. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
parent
964f7e5a56
commit
9922262242
1 changed files with 27 additions and 10 deletions
|
@ -291,31 +291,48 @@ struct syscall_metadata *syscall_nr_to_meta(int nr)
|
||||||
return syscalls_metadata[nr];
|
return syscalls_metadata[nr];
|
||||||
}
|
}
|
||||||
|
|
||||||
void arch_init_ftrace_syscalls(void)
|
int syscall_name_to_nr(char *name)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (!syscalls_metadata)
|
||||||
|
return -1;
|
||||||
|
for (i = 0; i < NR_syscalls; i++)
|
||||||
|
if (syscalls_metadata[i])
|
||||||
|
if (!strcmp(syscalls_metadata[i]->name, name))
|
||||||
|
return i;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_syscall_enter_id(int num, int id)
|
||||||
|
{
|
||||||
|
syscalls_metadata[num]->enter_id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_syscall_exit_id(int num, int id)
|
||||||
|
{
|
||||||
|
syscalls_metadata[num]->exit_id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int __init arch_init_ftrace_syscalls(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct syscall_metadata *meta;
|
struct syscall_metadata *meta;
|
||||||
unsigned long **psys_syscall_table = &sys_call_table;
|
unsigned long **psys_syscall_table = &sys_call_table;
|
||||||
static atomic_t refs;
|
|
||||||
|
|
||||||
if (atomic_inc_return(&refs) != 1)
|
|
||||||
goto end;
|
|
||||||
|
|
||||||
syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) *
|
syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) *
|
||||||
FTRACE_SYSCALL_MAX, GFP_KERNEL);
|
FTRACE_SYSCALL_MAX, GFP_KERNEL);
|
||||||
if (!syscalls_metadata) {
|
if (!syscalls_metadata) {
|
||||||
WARN_ON(1);
|
WARN_ON(1);
|
||||||
return;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < FTRACE_SYSCALL_MAX; i++) {
|
for (i = 0; i < FTRACE_SYSCALL_MAX; i++) {
|
||||||
meta = find_syscall_meta(psys_syscall_table[i]);
|
meta = find_syscall_meta(psys_syscall_table[i]);
|
||||||
syscalls_metadata[i] = meta;
|
syscalls_metadata[i] = meta;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
|
|
||||||
/* Paranoid: avoid overflow */
|
return 0;
|
||||||
end:
|
|
||||||
atomic_dec(&refs);
|
|
||||||
}
|
}
|
||||||
|
arch_initcall(arch_init_ftrace_syscalls);
|
||||||
#endif /* CONFIG_FTRACE_SYSCALLS */
|
#endif /* CONFIG_FTRACE_SYSCALLS */
|
||||||
|
|
Loading…
Add table
Reference in a new issue