1 #ifndef __ASM_SPARC_SYSCALL_H
2 #define __ASM_SPARC_SYSCALL_H
4 #include <linux/kernel.h>
5 #include <linux/sched.h>
6 #include <asm/ptrace.h>
9 * The syscall table always contains 32 bit pointers since we know that the
10 * address of the function to be called is (way) below 4GB. So the "int"
11 * type here is what we want [need] for both 32 bit and 64 bit systems.
13 extern const unsigned int sys_call_table
[];
15 /* The system call number is given by the user in %g1 */
16 static inline long syscall_get_nr(struct task_struct
*task
,
19 int syscall_p
= pt_regs_is_syscall(regs
);
21 return (syscall_p
? regs
->u_regs
[UREG_G1
] : -1L);
24 static inline void syscall_rollback(struct task_struct
*task
,
30 static inline bool syscall_has_error(struct pt_regs
*regs
)
32 return (regs
->psr
& PSR_C
) ? true : false;
34 static inline void syscall_set_error(struct pt_regs
*regs
)
38 static inline void syscall_clear_error(struct pt_regs
*regs
)
43 static inline bool syscall_has_error(struct pt_regs
*regs
)
45 return (regs
->tstate
& (TSTATE_XCARRY
| TSTATE_ICARRY
)) ? true : false;
47 static inline void syscall_set_error(struct pt_regs
*regs
)
49 regs
->tstate
|= (TSTATE_XCARRY
| TSTATE_ICARRY
);
51 static inline void syscall_clear_error(struct pt_regs
*regs
)
53 regs
->tstate
&= ~(TSTATE_XCARRY
| TSTATE_ICARRY
);
57 static inline long syscall_get_error(struct task_struct
*task
,
60 long val
= regs
->u_regs
[UREG_I0
];
62 return (syscall_has_error(regs
) ? -val
: 0);
65 static inline long syscall_get_return_value(struct task_struct
*task
,
68 long val
= regs
->u_regs
[UREG_I0
];
73 static inline void syscall_set_return_value(struct task_struct
*task
,
78 syscall_set_error(regs
);
79 regs
->u_regs
[UREG_I0
] = -error
;
81 syscall_clear_error(regs
);
82 regs
->u_regs
[UREG_I0
] = val
;
86 static inline void syscall_get_arguments(struct task_struct
*task
,
88 unsigned int i
, unsigned int n
,
95 if (test_tsk_thread_flag(task
, TIF_32BIT
))
99 for (j
= 0; j
< n
; j
++) {
100 unsigned long val
= regs
->u_regs
[UREG_I0
+ i
+ j
];
109 static inline void syscall_set_arguments(struct task_struct
*task
,
110 struct pt_regs
*regs
,
111 unsigned int i
, unsigned int n
,
112 const unsigned long *args
)
116 for (j
= 0; j
< n
; j
++)
117 regs
->u_regs
[UREG_I0
+ i
+ j
] = args
[j
];
120 #endif /* __ASM_SPARC_SYSCALL_H */