1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _ASM_M68K_SYSCALL_H 3 #define _ASM_M68K_SYSCALL_H 4 5 #include <uapi/linux/audit.h> 6 7 #include <asm/unistd.h> 8 9 extern const unsigned long sys_call_table[]; 10 11 static inline int syscall_get_nr(struct task_struct *task, 12 struct pt_regs *regs) 13 { 14 return regs->orig_d0; 15 } 16 17 static inline void syscall_set_nr(struct task_struct *task, 18 struct pt_regs *regs, 19 int nr) 20 { 21 regs->orig_d0 = nr; 22 } 23 24 static inline void syscall_rollback(struct task_struct *task, 25 struct pt_regs *regs) 26 { 27 regs->d0 = regs->orig_d0; 28 } 29 30 static inline long syscall_get_error(struct task_struct *task, 31 struct pt_regs *regs) 32 { 33 unsigned long error = regs->d0; 34 35 return IS_ERR_VALUE(error) ? error : 0; 36 } 37 38 static inline long syscall_get_return_value(struct task_struct *task, 39 struct pt_regs *regs) 40 { 41 return regs->d0; 42 } 43 44 static inline void syscall_set_return_value(struct task_struct *task, 45 struct pt_regs *regs, 46 int error, long val) 47 { 48 regs->d0 = (long)error ?: val; 49 } 50 51 static inline void syscall_get_arguments(struct task_struct *task, 52 struct pt_regs *regs, 53 unsigned long *args) 54 { 55 args[0] = regs->orig_d0; 56 args++; 57 58 memcpy(args, ®s->d1, 5 * sizeof(args[0])); 59 } 60 61 static inline void syscall_set_arguments(struct task_struct *task, 62 struct pt_regs *regs, 63 unsigned long *args) 64 { 65 regs->orig_d0 = args[0]; 66 args++; 67 68 memcpy(®s->d1, args, 5 * sizeof(args[0])); 69 } 70 71 static inline int syscall_get_arch(struct task_struct *task) 72 { 73 return AUDIT_ARCH_M68K; 74 } 75 76 #endif /* _ASM_M68K_SYSCALL_H */ 77