aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm/syscall.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2012-08-17 02:22:04 -0400
committerRalf Baechle <ralf@linux-mips.org>2013-10-29 16:25:11 -0400
commitc0ff3c53d4f99f5e0ac5fc30ad77f26159b347e0 (patch)
treeace67e4403900863e8532068c9caa120aa726d0a /arch/mips/include/asm/syscall.h
parent6a9c001b7ec3ae6639f97a5b7ea4b0ea35053b18 (diff)
MIPS: Enable HAVE_ARCH_TRACEHOOK.
This enables /proc/<pid>/syscall and the ptrace PTRACE_GETREGSET and PTRACE_SETREGSET operations. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/include/asm/syscall.h')
-rw-r--r--arch/mips/include/asm/syscall.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
index ab5effdc935d..00f2ffaaf293 100644
--- a/arch/mips/include/asm/syscall.h
+++ b/arch/mips/include/asm/syscall.h
@@ -1,14 +1,81 @@
1/* 1/*
2 * Access to user system call parameters and results
3 *
2 * This file is subject to the terms and conditions of the GNU General Public 4 * 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 5 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 6 * for more details.
5 * 7 *
8 * See asm-generic/syscall.h for descriptions of what we must do here.
9 *
6 * Copyright (C) 2012 Ralf Baechle <ralf@linux-mips.org> 10 * Copyright (C) 2012 Ralf Baechle <ralf@linux-mips.org>
7 */ 11 */
8 12
9#ifndef __ASM_MIPS_SYSCALL_H 13#ifndef __ASM_MIPS_SYSCALL_H
10#define __ASM_MIPS_SYSCALL_H 14#define __ASM_MIPS_SYSCALL_H
11 15
16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/uaccess.h>
19#include <asm/ptrace.h>
20
21static inline long syscall_get_nr(struct task_struct *task,
22 struct pt_regs *regs)
23{
24 return regs->regs[2];
25}
26
27static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
28 struct task_struct *task, struct pt_regs *regs, unsigned int n)
29{
30 unsigned long usp = regs->regs[29];
31
32 switch (n) {
33 case 0: case 1: case 2: case 3:
34 *arg = regs->regs[4 + n];
35
36 return 0;
37
38#ifdef CONFIG_32BIT
39 case 4: case 5: case 6: case 7:
40 return get_user(*arg, (int *)usp + 4 * n);
41#endif
42
43#ifdef CONFIG_64BIT
44 case 4: case 5: case 6: case 7:
45#ifdef CONFIG_MIPS32_O32
46 if (test_thread_flag(TIF_32BIT_REGS))
47 return get_user(*arg, (int *)usp + 4 * n);
48 else
49#endif
50 *arg = regs->regs[4 + n];
51
52 return 0;
53#endif
54
55 default:
56 BUG();
57 }
58}
59
60static inline void syscall_get_arguments(struct task_struct *task,
61 struct pt_regs *regs,
62 unsigned int i, unsigned int n,
63 unsigned long *args)
64{
65 unsigned long arg;
66 int ret;
67
68 while (n--)
69 ret |= mips_get_syscall_arg(&arg, task, regs, i++);
70
71 /*
72 * No way to communicate an error because this is a void function.
73 */
74#if 0
75 return ret;
76#endif
77}
78
12extern const unsigned long sys_call_table[]; 79extern const unsigned long sys_call_table[];
13extern const unsigned long sys32_call_table[]; 80extern const unsigned long sys32_call_table[];
14extern const unsigned long sysn32_call_table[]; 81extern const unsigned long sysn32_call_table[];