2 * Access to user system call parameters and results
4 * Copyright IBM Corp. 2008
5 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License (version 2 only)
9 * as published by the Free Software Foundation.
12 #ifndef _ASM_SYSCALL_H
13 #define _ASM_SYSCALL_H 1
15 #include <linux/sched.h>
16 #include <asm/ptrace.h>
19 * The syscall table always contains 32 bit pointers since we know that the
20 * address of the function to be called is (way) below 4GB. So the "int"
21 * type here is what we want [need] for both 32 bit and 64 bit systems.
23 extern const unsigned int sys_call_table
[];
25 static inline long syscall_get_nr(struct task_struct
*task
,
28 return regs
->svcnr
? regs
->svcnr
: -1;
31 static inline void syscall_rollback(struct task_struct
*task
,
34 regs
->gprs
[2] = regs
->orig_gpr2
;
37 static inline long syscall_get_error(struct task_struct
*task
,
40 return (regs
->gprs
[2] >= -4096UL) ? -regs
->gprs
[2] : 0;
43 static inline long syscall_get_return_value(struct task_struct
*task
,
49 static inline void syscall_set_return_value(struct task_struct
*task
,
53 regs
->gprs
[2] = error
? -error
: val
;
56 static inline void syscall_get_arguments(struct task_struct
*task
,
58 unsigned int i
, unsigned int n
,
61 unsigned long mask
= -1UL;
65 if (test_tsk_thread_flag(task
, TIF_31BIT
))
70 args
[n
] = regs
->gprs
[2 + i
+ n
] & mask
;
72 args
[0] = regs
->orig_gpr2
& mask
;
75 static inline void syscall_set_arguments(struct task_struct
*task
,
77 unsigned int i
, unsigned int n
,
78 const unsigned long *args
)
83 regs
->gprs
[2 + i
+ n
] = args
[n
];
85 regs
->orig_gpr2
= args
[0];
88 #endif /* _ASM_SYSCALL_H */