0001
0002
0003 #ifndef __ASM_SYSCALL_H
0004 #define __ASM_SYSCALL_H
0005
0006 #include <linux/sched.h>
0007 #include <linux/err.h>
0008 #include <abi/regdef.h>
0009 #include <uapi/linux/audit.h>
0010
0011 extern void *sys_call_table[];
0012
0013 static inline int
0014 syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
0015 {
0016 return regs_syscallid(regs);
0017 }
0018
0019 static inline void
0020 syscall_set_nr(struct task_struct *task, struct pt_regs *regs,
0021 int sysno)
0022 {
0023 regs_syscallid(regs) = sysno;
0024 }
0025
0026 static inline void
0027 syscall_rollback(struct task_struct *task, struct pt_regs *regs)
0028 {
0029 regs->a0 = regs->orig_a0;
0030 }
0031
0032 static inline long
0033 syscall_get_error(struct task_struct *task, struct pt_regs *regs)
0034 {
0035 unsigned long error = regs->a0;
0036
0037 return IS_ERR_VALUE(error) ? error : 0;
0038 }
0039
0040 static inline long
0041 syscall_get_return_value(struct task_struct *task, struct pt_regs *regs)
0042 {
0043 return regs->a0;
0044 }
0045
0046 static inline void
0047 syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
0048 int error, long val)
0049 {
0050 regs->a0 = (long) error ?: val;
0051 }
0052
0053 static inline void
0054 syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
0055 unsigned long *args)
0056 {
0057 args[0] = regs->orig_a0;
0058 args++;
0059 memcpy(args, ®s->a1, 5 * sizeof(args[0]));
0060 }
0061
0062 static inline int
0063 syscall_get_arch(struct task_struct *task)
0064 {
0065 return AUDIT_ARCH_CSKY;
0066 }
0067
0068 #endif