Kyle McMartin | 40e03b6 | 2009-07-05 15:59:56 -0400 | [diff] [blame] | 1 | /* syscall.h */ |
| 2 | |
| 3 | #ifndef _ASM_PARISC_SYSCALL_H_ |
| 4 | #define _ASM_PARISC_SYSCALL_H_ |
| 5 | |
Eric Paris | ce5d112 | 2014-03-11 13:50:46 -0400 | [diff] [blame] | 6 | #include <uapi/linux/audit.h> |
| 7 | #include <linux/compat.h> |
Kyle McMartin | 40e03b6 | 2009-07-05 15:59:56 -0400 | [diff] [blame] | 8 | #include <linux/err.h> |
| 9 | #include <asm/ptrace.h> |
| 10 | |
| 11 | static inline long syscall_get_nr(struct task_struct *tsk, |
| 12 | struct pt_regs *regs) |
| 13 | { |
| 14 | return regs->gr[20]; |
| 15 | } |
| 16 | |
| 17 | static inline void syscall_get_arguments(struct task_struct *tsk, |
| 18 | struct pt_regs *regs, unsigned int i, |
| 19 | unsigned int n, unsigned long *args) |
| 20 | { |
| 21 | BUG_ON(i); |
| 22 | |
| 23 | switch (n) { |
| 24 | case 6: |
| 25 | args[5] = regs->gr[21]; |
| 26 | case 5: |
| 27 | args[4] = regs->gr[22]; |
| 28 | case 4: |
| 29 | args[3] = regs->gr[23]; |
| 30 | case 3: |
| 31 | args[2] = regs->gr[24]; |
| 32 | case 2: |
| 33 | args[1] = regs->gr[25]; |
| 34 | case 1: |
| 35 | args[0] = regs->gr[26]; |
| 36 | break; |
| 37 | default: |
| 38 | BUG(); |
| 39 | } |
| 40 | } |
| 41 | |
Helge Deller | 910cd32 | 2016-03-30 14:14:31 +0200 | [diff] [blame^] | 42 | static inline void syscall_set_return_value(struct task_struct *task, |
| 43 | struct pt_regs *regs, |
| 44 | int error, long val) |
| 45 | { |
| 46 | regs->gr[28] = error ? error : val; |
| 47 | } |
| 48 | |
| 49 | static inline void syscall_rollback(struct task_struct *task, |
| 50 | struct pt_regs *regs) |
| 51 | { |
| 52 | /* do nothing */ |
| 53 | } |
| 54 | |
Eric Paris | ce5d112 | 2014-03-11 13:50:46 -0400 | [diff] [blame] | 55 | static inline int syscall_get_arch(void) |
| 56 | { |
| 57 | int arch = AUDIT_ARCH_PARISC; |
| 58 | #ifdef CONFIG_64BIT |
| 59 | if (!is_compat_task()) |
| 60 | arch = AUDIT_ARCH_PARISC64; |
| 61 | #endif |
| 62 | return arch; |
| 63 | } |
Kyle McMartin | 40e03b6 | 2009-07-05 15:59:56 -0400 | [diff] [blame] | 64 | #endif /*_ASM_PARISC_SYSCALL_H_*/ |