1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Access to user system call parameters and results
5 * Copyright IBM Corp. 2008
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
10 #define _ASM_SYSCALL_H 1
12 #include <uapi/linux/audit.h>
13 #include <linux/sched.h>
14 #include <linux/err.h>
15 #include <asm/ptrace.h>
17 extern const unsigned long sys_call_table[];
18 extern const unsigned long sys_call_table_emu[];
20 static inline long syscall_get_nr(struct task_struct *task,
23 return test_pt_regs_flag(regs, PIF_SYSCALL) ?
24 (regs->int_code & 0xffff) : -1;
27 static inline void syscall_rollback(struct task_struct *task,
30 regs->gprs[2] = regs->orig_gpr2;
33 static inline long syscall_get_error(struct task_struct *task,
36 return IS_ERR_VALUE(regs->gprs[2]) ? regs->gprs[2] : 0;
39 static inline long syscall_get_return_value(struct task_struct *task,
45 static inline void syscall_set_return_value(struct task_struct *task,
49 regs->gprs[2] = error ? error : val;
52 static inline void syscall_get_arguments(struct task_struct *task,
56 unsigned long mask = -1UL;
60 if (test_tsk_thread_flag(task, TIF_31BIT))
65 args[n] = regs->gprs[2 + n] & mask;
67 args[0] = regs->orig_gpr2 & mask;
70 static inline void syscall_set_arguments(struct task_struct *task,
72 const unsigned long *args)
78 regs->gprs[2 + n] = args[n];
79 regs->orig_gpr2 = args[0];
82 static inline int syscall_get_arch(struct task_struct *task)
85 if (test_tsk_thread_flag(task, TIF_31BIT))
86 return AUDIT_ARCH_S390;
88 return AUDIT_ARCH_S390X;
90 #endif /* _ASM_SYSCALL_H */