| .. | .. |
|---|
| 14 | 14 | #include <linux/err.h> |
|---|
| 15 | 15 | #include <asm/ptrace.h> |
|---|
| 16 | 16 | |
|---|
| 17 | | -/* |
|---|
| 18 | | - * The syscall table always contains 32 bit pointers since we know that the |
|---|
| 19 | | - * address of the function to be called is (way) below 4GB. So the "int" |
|---|
| 20 | | - * type here is what we want [need] for both 32 bit and 64 bit systems. |
|---|
| 21 | | - */ |
|---|
| 22 | | -extern const unsigned int sys_call_table[]; |
|---|
| 23 | | -extern const unsigned int sys_call_table_emu[]; |
|---|
| 17 | +extern const unsigned long sys_call_table[]; |
|---|
| 18 | +extern const unsigned long sys_call_table_emu[]; |
|---|
| 24 | 19 | |
|---|
| 25 | 20 | static inline long syscall_get_nr(struct task_struct *task, |
|---|
| 26 | 21 | struct pt_regs *regs) |
|---|
| .. | .. |
|---|
| 66 | 61 | |
|---|
| 67 | 62 | static inline void syscall_get_arguments(struct task_struct *task, |
|---|
| 68 | 63 | struct pt_regs *regs, |
|---|
| 69 | | - unsigned int i, unsigned int n, |
|---|
| 70 | 64 | unsigned long *args) |
|---|
| 71 | 65 | { |
|---|
| 72 | 66 | unsigned long mask = -1UL; |
|---|
| 67 | + unsigned int n = 6; |
|---|
| 73 | 68 | |
|---|
| 74 | | - /* |
|---|
| 75 | | - * No arguments for this syscall, there's nothing to do. |
|---|
| 76 | | - */ |
|---|
| 77 | | - if (!n) |
|---|
| 78 | | - return; |
|---|
| 79 | | - |
|---|
| 80 | | - BUG_ON(i + n > 6); |
|---|
| 81 | 69 | #ifdef CONFIG_COMPAT |
|---|
| 82 | 70 | if (test_tsk_thread_flag(task, TIF_31BIT)) |
|---|
| 83 | 71 | mask = 0xffffffff; |
|---|
| 84 | 72 | #endif |
|---|
| 85 | 73 | while (n-- > 0) |
|---|
| 86 | | - if (i + n > 0) |
|---|
| 87 | | - args[n] = regs->gprs[2 + i + n] & mask; |
|---|
| 88 | | - if (i == 0) |
|---|
| 89 | | - args[0] = regs->orig_gpr2 & mask; |
|---|
| 74 | + if (n > 0) |
|---|
| 75 | + args[n] = regs->gprs[2 + n] & mask; |
|---|
| 76 | + |
|---|
| 77 | + args[0] = regs->orig_gpr2 & mask; |
|---|
| 90 | 78 | } |
|---|
| 91 | 79 | |
|---|
| 92 | 80 | static inline void syscall_set_arguments(struct task_struct *task, |
|---|
| 93 | 81 | struct pt_regs *regs, |
|---|
| 94 | | - unsigned int i, unsigned int n, |
|---|
| 95 | 82 | const unsigned long *args) |
|---|
| 96 | 83 | { |
|---|
| 97 | | - BUG_ON(i + n > 6); |
|---|
| 84 | + unsigned int n = 6; |
|---|
| 85 | + |
|---|
| 98 | 86 | while (n-- > 0) |
|---|
| 99 | | - if (i + n > 0) |
|---|
| 100 | | - regs->gprs[2 + i + n] = args[n]; |
|---|
| 101 | | - if (i == 0) |
|---|
| 102 | | - regs->orig_gpr2 = args[0]; |
|---|
| 87 | + if (n > 0) |
|---|
| 88 | + regs->gprs[2 + n] = args[n]; |
|---|
| 89 | + regs->orig_gpr2 = args[0]; |
|---|
| 103 | 90 | } |
|---|
| 104 | 91 | |
|---|
| 105 | | -static inline int syscall_get_arch(void) |
|---|
| 92 | +static inline int syscall_get_arch(struct task_struct *task) |
|---|
| 106 | 93 | { |
|---|
| 107 | 94 | #ifdef CONFIG_COMPAT |
|---|
| 108 | | - if (test_tsk_thread_flag(current, TIF_31BIT)) |
|---|
| 95 | + if (test_tsk_thread_flag(task, TIF_31BIT)) |
|---|
| 109 | 96 | return AUDIT_ARCH_S390; |
|---|
| 110 | 97 | #endif |
|---|
| 111 | 98 | return AUDIT_ARCH_S390X; |
|---|