Skip to content

Commit 756276c

Browse files
bibo-maotsbogend
authored andcommitted
MIPS: Use arch specific syscall name match function
On MIPS system, most of the syscall function name begin with prefix sys_. Some syscalls are special such as clone/fork, function name of these begin with __sys_. Since scratch registers need be saved in stack when these system calls happens. With ftrace system call method, system call functions are declared with SYSCALL_DEFINEx, metadata of the system call symbol name begins with sys_. Here mips specific function arch_syscall_match_sym_name is used to compare function name between sys_call_table[] and metadata of syscall symbol. Signed-off-by: Bibo Mao <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 5ae16e2 commit 756276c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

arch/mips/include/asm/ftrace.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,20 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra,
9191

9292
#endif /* __ASSEMBLY__ */
9393
#endif /* CONFIG_FUNCTION_TRACER */
94+
95+
#ifdef CONFIG_FTRACE_SYSCALLS
96+
#ifndef __ASSEMBLY__
97+
/*
98+
* Some syscall entry functions on mips start with "__sys_" (fork and clone,
99+
* for instance). We should also match the sys_ variant with those.
100+
*/
101+
#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
102+
static inline bool arch_syscall_match_sym_name(const char *sym,
103+
const char *name)
104+
{
105+
return !strcmp(sym, name) ||
106+
(!strncmp(sym, "__sys_", 6) && !strcmp(sym + 6, name + 4));
107+
}
108+
#endif /* __ASSEMBLY__ */
109+
#endif /* CONFIG_FTRACE_SYSCALLS */
94110
#endif /* _ASM_MIPS_FTRACE_H */

0 commit comments

Comments
 (0)