temp: SR: IO_ADDRESS conversion
[linux-ginger.git] / arch / sh / include / asm / syscall_64.h
blobc3561ca72bee9fb284dbe52b823da3ca6feadbc0
1 #ifndef __ASM_SH_SYSCALL_64_H
2 #define __ASM_SH_SYSCALL_64_H
4 #include <linux/kernel.h>
5 #include <linux/sched.h>
6 #include <asm/ptrace.h>
8 /* The system call number is given by the user in R9 */
9 static inline long syscall_get_nr(struct task_struct *task,
10 struct pt_regs *regs)
12 return (regs->syscall_nr >= 0) ? regs->regs[9] : -1L;
15 static inline void syscall_rollback(struct task_struct *task,
16 struct pt_regs *regs)
19 * XXX: This needs some thought. On SH we don't
20 * save away the original R9 value anywhere.
24 static inline long syscall_get_error(struct task_struct *task,
25 struct pt_regs *regs)
27 return IS_ERR_VALUE(regs->regs[9]) ? regs->regs[9] : 0;
30 static inline long syscall_get_return_value(struct task_struct *task,
31 struct pt_regs *regs)
33 return regs->regs[9];
36 static inline void syscall_set_return_value(struct task_struct *task,
37 struct pt_regs *regs,
38 int error, long val)
40 if (error)
41 regs->regs[9] = -error;
42 else
43 regs->regs[9] = val;
46 static inline void syscall_get_arguments(struct task_struct *task,
47 struct pt_regs *regs,
48 unsigned int i, unsigned int n,
49 unsigned long *args)
51 BUG_ON(i + n > 6);
52 memcpy(args, &regs->regs[2 + i], n * sizeof(args[0]));
55 static inline void syscall_set_arguments(struct task_struct *task,
56 struct pt_regs *regs,
57 unsigned int i, unsigned int n,
58 const unsigned long *args)
60 BUG_ON(i + n > 6);
61 memcpy(&regs->regs[2 + i], args, n * sizeof(args[0]));
64 #endif /* __ASM_SH_SYSCALL_64_H */