Merge branch 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[GitHub/moto-9609/android_kernel_motorola_exynos9610.git] / arch / parisc / include / asm / syscall.h
CommitLineData
40e03b68
KM
1/* syscall.h */
2
3#ifndef _ASM_PARISC_SYSCALL_H_
4#define _ASM_PARISC_SYSCALL_H_
5
ce5d1128
EP
6#include <uapi/linux/audit.h>
7#include <linux/compat.h>
40e03b68
KM
8#include <linux/err.h>
9#include <asm/ptrace.h>
10
fc79168a
HD
11#define NR_syscalls (__NR_Linux_syscalls)
12
40e03b68
KM
13static inline long syscall_get_nr(struct task_struct *tsk,
14 struct pt_regs *regs)
15{
16 return regs->gr[20];
17}
18
19static inline void syscall_get_arguments(struct task_struct *tsk,
20 struct pt_regs *regs, unsigned int i,
21 unsigned int n, unsigned long *args)
22{
23 BUG_ON(i);
24
25 switch (n) {
26 case 6:
27 args[5] = regs->gr[21];
28 case 5:
29 args[4] = regs->gr[22];
30 case 4:
31 args[3] = regs->gr[23];
32 case 3:
33 args[2] = regs->gr[24];
34 case 2:
35 args[1] = regs->gr[25];
36 case 1:
37 args[0] = regs->gr[26];
fc79168a 38 case 0:
40e03b68
KM
39 break;
40 default:
41 BUG();
42 }
43}
44
fc79168a
HD
45static inline long syscall_get_return_value(struct task_struct *task,
46 struct pt_regs *regs)
47{
48 return regs->gr[28];
49}
50
910cd32e
HD
51static inline void syscall_set_return_value(struct task_struct *task,
52 struct pt_regs *regs,
53 int error, long val)
54{
55 regs->gr[28] = error ? error : val;
56}
57
58static inline void syscall_rollback(struct task_struct *task,
59 struct pt_regs *regs)
60{
61 /* do nothing */
62}
63
ce5d1128
EP
64static inline int syscall_get_arch(void)
65{
66 int arch = AUDIT_ARCH_PARISC;
67#ifdef CONFIG_64BIT
68 if (!is_compat_task())
69 arch = AUDIT_ARCH_PARISC64;
70#endif
71 return arch;
72}
40e03b68 73#endif /*_ASM_PARISC_SYSCALL_H_*/