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 | |
Helge Deller | fc79168 | 2016-04-13 22:44:54 +0200 | [diff] [blame] | 11 | #define NR_syscalls (__NR_Linux_syscalls) |
| 12 | |
Kyle McMartin | 40e03b6 | 2009-07-05 15:59:56 -0400 | [diff] [blame] | 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]; |
Helge Deller | fc79168 | 2016-04-13 22:44:54 +0200 | [diff] [blame] | 38 | case 0: |
Kyle McMartin | 40e03b6 | 2009-07-05 15:59:56 -0400 | [diff] [blame] | 39 | break; |
| 40 | default: |
| 41 | BUG(); |
| 42 | } |
| 43 | } |
| 44 | |
Helge Deller | fc79168 | 2016-04-13 22:44:54 +0200 | [diff] [blame] | 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 | |
Helge Deller | 910cd32 | 2016-03-30 14:14:31 +0200 | [diff] [blame] | 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 | |
Eric Paris | ce5d112 | 2014-03-11 13:50:46 -0400 | [diff] [blame] | 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 | } |
Kyle McMartin | 40e03b6 | 2009-07-05 15:59:56 -0400 | [diff] [blame] | 73 | #endif /*_ASM_PARISC_SYSCALL_H_*/ |