aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2012-07-13 17:38:17 -0400
committerRalf Baechle <ralf@linux-mips.org>2013-10-29 16:25:01 -0400
commit19e2e172f0ed2552793ecef506b00c3fa3421845 (patch)
treeca324a14964fd13fd7957c2e30baa196cee1e998 /arch/mips
parent403342a82d7959ad76210778cfcd7e26f7dd98cd (diff)
MIPS: Provide arch_syscall_addr.
The generic version is wrong for MIPS. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/include/asm/syscall.h16
-rw-r--r--arch/mips/kernel/Makefile1
-rw-r--r--arch/mips/kernel/ftrace.c33
3 files changed, 50 insertions, 0 deletions
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
new file mode 100644
index 000000000000..ab5effdc935d
--- /dev/null
+++ b/arch/mips/include/asm/syscall.h
@@ -0,0 +1,16 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2012 Ralf Baechle <ralf@linux-mips.org>
7 */
8
9#ifndef __ASM_MIPS_SYSCALL_H
10#define __ASM_MIPS_SYSCALL_H
11
12extern const unsigned long sys_call_table[];
13extern const unsigned long sys32_call_table[];
14extern const unsigned long sysn32_call_table[];
15
16#endif /* __ASM_MIPS_SYSCALL_H */
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 4bbece9b3eb4..81773a4508f4 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -35,6 +35,7 @@ obj-$(CONFIG_STACKTRACE) += stacktrace.o
35obj-$(CONFIG_MODULES) += mips_ksyms.o module.o 35obj-$(CONFIG_MODULES) += mips_ksyms.o module.o
36obj-$(CONFIG_MODULES_USE_ELF_RELA) += module-rela.o 36obj-$(CONFIG_MODULES_USE_ELF_RELA) += module-rela.o
37 37
38obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o
38obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o 39obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o
39 40
40obj-$(CONFIG_CPU_R4K_FPU) += r4k_fpu.o r4k_switch.o 41obj-$(CONFIG_CPU_R4K_FPU) += r4k_fpu.o r4k_switch.o
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index dba90ec0dc38..6e022c44f447 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
@@ -11,11 +11,14 @@
11#include <linux/uaccess.h> 11#include <linux/uaccess.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/ftrace.h> 13#include <linux/ftrace.h>
14#include <linux/syscalls.h>
14 15
15#include <asm/asm.h> 16#include <asm/asm.h>
16#include <asm/asm-offsets.h> 17#include <asm/asm-offsets.h>
17#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
19#include <asm/syscall.h>
18#include <asm/uasm.h> 20#include <asm/uasm.h>
21#include <asm/unistd.h>
19 22
20#include <asm-generic/sections.h> 23#include <asm-generic/sections.h>
21 24
@@ -364,3 +367,33 @@ out:
364 WARN_ON(1); 367 WARN_ON(1);
365} 368}
366#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 369#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
370
371#ifdef CONFIG_FTRACE_SYSCALLS
372
373#ifdef CONFIG_32BIT
374unsigned long __init arch_syscall_addr(int nr)
375{
376 return (unsigned long)sys_call_table[nr - __NR_O32_Linux];
377}
378#endif
379
380#ifdef CONFIG_64BIT
381
382unsigned long __init arch_syscall_addr(int nr)
383{
384#ifdef CONFIG_MIPS32_N32
385 if (nr >= __NR_N32_Linux && nr <= __NR_N32_Linux + __NR_N32_Linux_syscalls)
386 return (unsigned long)sysn32_call_table[(nr - __NR_N32_Linux) * 2];
387#endif
388 if (nr >= __NR_64_Linux && nr <= __NR_64_Linux + __NR_64_Linux_syscalls)
389 return (unsigned long)sys_call_table[nr - __NR_64_Linux];
390#ifdef CONFIG_MIPS32_O32
391 if (nr >= __NR_O32_Linux && nr <= __NR_O32_Linux + __NR_O32_Linux_syscalls)
392 return (unsigned long)sys32_call_table[nr - __NR_O32_Linux];
393#endif
394
395 return (unsigned long) &sys_ni_syscall;
396}
397#endif
398
399#endif /* CONFIG_FTRACE_SYSCALLS */