1 /* syscall.h */ 2 3 #ifndef _ASM_PARISC_SYSCALL_H_ 4 #define _ASM_PARISC_SYSCALL_H_ 5 6 #include <uapi/linux/audit.h> 7 #include <linux/compat.h> 8 #include <linux/err.h> 9 #include <asm/ptrace.h> 10 11 #define NR_syscalls (__NR_Linux_syscalls) 12 13 static inline long syscall_get_nr(struct task_struct *tsk, 14 struct pt_regs *regs) 15 { 16 return regs->gr[20]; 17 } 18 19 static 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]; 38 case 0: 39 break; 40 default: 41 BUG(); 42 } 43 } 44 45 static inline long syscall_get_return_value(struct task_struct *task, 46 struct pt_regs *regs) 47 { 48 return regs->gr[28]; 49 } 50 51 static 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 58 static inline void syscall_rollback(struct task_struct *task, 59 struct pt_regs *regs) 60 { 61 /* do nothing */ 62 } 63 64 static 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 } 73 #endif /*_ASM_PARISC_SYSCALL_H_*/ 74