blob: 5e0b4e6bd99d14c94437ae409faca2ae413d9cde [file] [log] [blame]
Kyle McMartin40e03b62009-07-05 15:59:56 -04001/* syscall.h */
2
3#ifndef _ASM_PARISC_SYSCALL_H_
4#define _ASM_PARISC_SYSCALL_H_
5
Eric Parisce5d1122014-03-11 13:50:46 -04006#include <uapi/linux/audit.h>
7#include <linux/compat.h>
Kyle McMartin40e03b62009-07-05 15:59:56 -04008#include <linux/err.h>
9#include <asm/ptrace.h>
10
Helge Dellerfc791682016-04-13 22:44:54 +020011#define NR_syscalls (__NR_Linux_syscalls)
12
Kyle McMartin40e03b62009-07-05 15:59:56 -040013static 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];
Helge Dellerfc791682016-04-13 22:44:54 +020038 case 0:
Kyle McMartin40e03b62009-07-05 15:59:56 -040039 break;
40 default:
41 BUG();
42 }
43}
44
Helge Dellerfc791682016-04-13 22:44:54 +020045static inline long syscall_get_return_value(struct task_struct *task,
46 struct pt_regs *regs)
47{
48 return regs->gr[28];
49}
50
Helge Deller910cd322016-03-30 14:14:31 +020051static 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
Eric Parisce5d1122014-03-11 13:50:46 -040064static 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 McMartin40e03b62009-07-05 15:59:56 -040073#endif /*_ASM_PARISC_SYSCALL_H_*/