File Index
Files and directories
Sign in
FILE

syscall.h

File preview with syntax highlighting.

linux-6.19.14/arch/parisc/include/asm/syscall.h C
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/* syscall.h */
 3
 4#ifndef _ASM_PARISC_SYSCALL_H_
 5#define _ASM_PARISC_SYSCALL_H_
 6
 7#include <uapi/linux/audit.h>
 8#include <linux/compat.h>
 9#include <linux/err.h>
10#include <asm/ptrace.h>
11
12#define NR_syscalls (__NR_Linux_syscalls)
13
14static inline long syscall_get_nr(struct task_struct *tsk,
15				  struct pt_regs *regs)
16{
17	return regs->gr[20];
18}
19
20static inline void syscall_set_nr(struct task_struct *tsk,
21				  struct pt_regs *regs,
22				  int nr)
23{
24	regs->gr[20] = nr;
25}
26
27static inline void syscall_get_arguments(struct task_struct *tsk,
28					 struct pt_regs *regs,
29					 unsigned long *args)
30{
31	args[5] = regs->gr[21];
32	args[4] = regs->gr[22];
33	args[3] = regs->gr[23];
34	args[2] = regs->gr[24];
35	args[1] = regs->gr[25];
36	args[0] = regs->gr[26];
37}
38
39static inline void syscall_set_arguments(struct task_struct *tsk,
40					 struct pt_regs *regs,
41					 unsigned long *args)
42{
43	regs->gr[21] = args[5];
44	regs->gr[22] = args[4];
45	regs->gr[23] = args[3];
46	regs->gr[24] = args[2];
47	regs->gr[25] = args[1];
48	regs->gr[26] = args[0];
49}
50
51static inline long syscall_get_error(struct task_struct *task,
52				     struct pt_regs *regs)
53{
54	unsigned long error = regs->gr[28];
55	return IS_ERR_VALUE(error) ? error : 0;
56}
57
58static inline long syscall_get_return_value(struct task_struct *task,
59						struct pt_regs *regs)
60{
61	return regs->gr[28];
62}
63
64static inline void syscall_set_return_value(struct task_struct *task,
65					    struct pt_regs *regs,
66					    int error, long val)
67{
68	regs->gr[28] = error ? error : val;
69}
70
71static inline void syscall_rollback(struct task_struct *task,
72				    struct pt_regs *regs)
73{
74	/* do nothing */
75}
76
77static inline int syscall_get_arch(struct task_struct *task)
78{
79	int arch = AUDIT_ARCH_PARISC;
80#ifdef CONFIG_64BIT
81	if (!__is_compat_task(task))
82		arch = AUDIT_ARCH_PARISC64;
83#endif
84	return arch;
85}
86#endif /*_ASM_PARISC_SYSCALL_H_*/
~/ Read-only file preview.