0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef __UM_SYSCALL_GENERIC_H
0011 #define __UM_SYSCALL_GENERIC_H
0012
0013 #include <asm/ptrace.h>
0014 #include <linux/err.h>
0015 #include <linux/sched.h>
0016 #include <sysdep/ptrace.h>
0017
0018 static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
0019 {
0020
0021 return PT_REGS_SYSCALL_NR(regs);
0022 }
0023
0024 static inline void syscall_rollback(struct task_struct *task,
0025 struct pt_regs *regs)
0026 {
0027
0028 }
0029
0030 static inline long syscall_get_error(struct task_struct *task,
0031 struct pt_regs *regs)
0032 {
0033 const long error = regs_return_value(regs);
0034
0035 return IS_ERR_VALUE(error) ? error : 0;
0036 }
0037
0038 static inline long syscall_get_return_value(struct task_struct *task,
0039 struct pt_regs *regs)
0040 {
0041 return regs_return_value(regs);
0042 }
0043
0044 static inline void syscall_set_return_value(struct task_struct *task,
0045 struct pt_regs *regs,
0046 int error, long val)
0047 {
0048 PT_REGS_SET_SYSCALL_RETURN(regs, (long) error ?: val);
0049 }
0050
0051 static inline void syscall_get_arguments(struct task_struct *task,
0052 struct pt_regs *regs,
0053 unsigned long *args)
0054 {
0055 const struct uml_pt_regs *r = ®s->regs;
0056
0057 *args++ = UPT_SYSCALL_ARG1(r);
0058 *args++ = UPT_SYSCALL_ARG2(r);
0059 *args++ = UPT_SYSCALL_ARG3(r);
0060 *args++ = UPT_SYSCALL_ARG4(r);
0061 *args++ = UPT_SYSCALL_ARG5(r);
0062 *args = UPT_SYSCALL_ARG6(r);
0063 }
0064
0065
0066
0067 #endif