2 * Access to user system call parameters and results
4 * Copyright (C) 2008 Imagination Technologies Ltd.
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU General Public License v.2.
10 * See asm-generic/syscall.h for descriptions of what we must do here.
13 #ifndef _ASM_METAG_SYSCALL_H
14 #define _ASM_METAG_SYSCALL_H
16 #include <linux/sched.h>
17 #include <linux/err.h>
18 #include <linux/uaccess.h>
20 #include <asm/switch.h>
22 static inline long syscall_get_nr(struct task_struct
*task
,
28 * FIXME there's no way to find out how we got here other than to
29 * examine the memory at the PC to see if it is a syscall
32 if (get_user(insn
, (unsigned long *)(regs
->ctx
.CurrPC
- 4)))
35 if (insn
== __METAG_SW_ENCODING(SYS
))
36 return regs
->ctx
.DX
[0].U1
;
41 static inline void syscall_rollback(struct task_struct
*task
,
47 static inline long syscall_get_error(struct task_struct
*task
,
50 unsigned long error
= regs
->ctx
.DX
[0].U0
;
51 return IS_ERR_VALUE(error
) ? error
: 0;
54 static inline long syscall_get_return_value(struct task_struct
*task
,
57 return regs
->ctx
.DX
[0].U0
;
60 static inline void syscall_set_return_value(struct task_struct
*task
,
64 regs
->ctx
.DX
[0].U0
= (long) error
?: val
;
67 static inline void syscall_get_arguments(struct task_struct
*task
,
69 unsigned int i
, unsigned int n
,
75 for (j
= i
, reg
= 6 - i
; j
< (i
+ n
); j
++, reg
--) {
77 args
[j
] = regs
->ctx
.DX
[(reg
+ 1) / 2].U0
;
79 args
[j
] = regs
->ctx
.DX
[reg
/ 2].U1
;
83 static inline void syscall_set_arguments(struct task_struct
*task
,
85 unsigned int i
, unsigned int n
,
86 const unsigned long *args
)
91 for (reg
= 6 - i
; i
< (i
+ n
); i
++, reg
--) {
93 regs
->ctx
.DX
[(reg
+ 1) / 2].U0
= args
[i
];
95 regs
->ctx
.DX
[reg
/ 2].U1
= args
[i
];
99 #define NR_syscalls __NR_syscalls
101 /* generic syscall table */
102 extern const void *sys_call_table
[];
104 #endif /* _ASM_METAG_SYSCALL_H */
This page took 0.049793 seconds and 5 git commands to generate.