Loading arch/mips/include/asm/syscall.h 0 → 100644 +16 −0 Original line number Diff line number Diff line /* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2012 Ralf Baechle <ralf@linux-mips.org> */ #ifndef __ASM_MIPS_SYSCALL_H #define __ASM_MIPS_SYSCALL_H extern const unsigned long sys_call_table[]; extern const unsigned long sys32_call_table[]; extern const unsigned long sysn32_call_table[]; #endif /* __ASM_MIPS_SYSCALL_H */ arch/mips/kernel/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-$(CONFIG_MODULES) += mips_ksyms.o module.o obj-$(CONFIG_MODULES_USE_ELF_RELA) += module-rela.o obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o obj-$(CONFIG_CPU_R4K_FPU) += r4k_fpu.o r4k_switch.o Loading arch/mips/kernel/ftrace.c +33 −0 Original line number Diff line number Diff line Loading @@ -11,11 +11,14 @@ #include <linux/uaccess.h> #include <linux/init.h> #include <linux/ftrace.h> #include <linux/syscalls.h> #include <asm/asm.h> #include <asm/asm-offsets.h> #include <asm/cacheflush.h> #include <asm/syscall.h> #include <asm/uasm.h> #include <asm/unistd.h> #include <asm-generic/sections.h> Loading Loading @@ -364,3 +367,33 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra, WARN_ON(1); } #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ #ifdef CONFIG_FTRACE_SYSCALLS #ifdef CONFIG_32BIT unsigned long __init arch_syscall_addr(int nr) { return (unsigned long)sys_call_table[nr - __NR_O32_Linux]; } #endif #ifdef CONFIG_64BIT unsigned long __init arch_syscall_addr(int nr) { #ifdef CONFIG_MIPS32_N32 if (nr >= __NR_N32_Linux && nr <= __NR_N32_Linux + __NR_N32_Linux_syscalls) return (unsigned long)sysn32_call_table[(nr - __NR_N32_Linux) * 2]; #endif if (nr >= __NR_64_Linux && nr <= __NR_64_Linux + __NR_64_Linux_syscalls) return (unsigned long)sys_call_table[nr - __NR_64_Linux]; #ifdef CONFIG_MIPS32_O32 if (nr >= __NR_O32_Linux && nr <= __NR_O32_Linux + __NR_O32_Linux_syscalls) return (unsigned long)sys32_call_table[nr - __NR_O32_Linux]; #endif return (unsigned long) &sys_ni_syscall; } #endif #endif /* CONFIG_FTRACE_SYSCALLS */ Loading
arch/mips/include/asm/syscall.h 0 → 100644 +16 −0 Original line number Diff line number Diff line /* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2012 Ralf Baechle <ralf@linux-mips.org> */ #ifndef __ASM_MIPS_SYSCALL_H #define __ASM_MIPS_SYSCALL_H extern const unsigned long sys_call_table[]; extern const unsigned long sys32_call_table[]; extern const unsigned long sysn32_call_table[]; #endif /* __ASM_MIPS_SYSCALL_H */
arch/mips/kernel/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-$(CONFIG_MODULES) += mips_ksyms.o module.o obj-$(CONFIG_MODULES_USE_ELF_RELA) += module-rela.o obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o obj-$(CONFIG_CPU_R4K_FPU) += r4k_fpu.o r4k_switch.o Loading
arch/mips/kernel/ftrace.c +33 −0 Original line number Diff line number Diff line Loading @@ -11,11 +11,14 @@ #include <linux/uaccess.h> #include <linux/init.h> #include <linux/ftrace.h> #include <linux/syscalls.h> #include <asm/asm.h> #include <asm/asm-offsets.h> #include <asm/cacheflush.h> #include <asm/syscall.h> #include <asm/uasm.h> #include <asm/unistd.h> #include <asm-generic/sections.h> Loading Loading @@ -364,3 +367,33 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra, WARN_ON(1); } #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ #ifdef CONFIG_FTRACE_SYSCALLS #ifdef CONFIG_32BIT unsigned long __init arch_syscall_addr(int nr) { return (unsigned long)sys_call_table[nr - __NR_O32_Linux]; } #endif #ifdef CONFIG_64BIT unsigned long __init arch_syscall_addr(int nr) { #ifdef CONFIG_MIPS32_N32 if (nr >= __NR_N32_Linux && nr <= __NR_N32_Linux + __NR_N32_Linux_syscalls) return (unsigned long)sysn32_call_table[(nr - __NR_N32_Linux) * 2]; #endif if (nr >= __NR_64_Linux && nr <= __NR_64_Linux + __NR_64_Linux_syscalls) return (unsigned long)sys_call_table[nr - __NR_64_Linux]; #ifdef CONFIG_MIPS32_O32 if (nr >= __NR_O32_Linux && nr <= __NR_O32_Linux + __NR_O32_Linux_syscalls) return (unsigned long)sys32_call_table[nr - __NR_O32_Linux]; #endif return (unsigned long) &sys_ni_syscall; } #endif #endif /* CONFIG_FTRACE_SYSCALLS */