aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/include/asm/syscall.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/include/asm/syscall.h')
-rw-r--r--arch/s390/include/asm/syscall.h28
1 files changed, 16 insertions, 12 deletions
diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
index 6e623971fbb9..2429b87eb28d 100644
--- a/arch/s390/include/asm/syscall.h
+++ b/arch/s390/include/asm/syscall.h
@@ -17,9 +17,7 @@
17static inline long syscall_get_nr(struct task_struct *task, 17static inline long syscall_get_nr(struct task_struct *task,
18 struct pt_regs *regs) 18 struct pt_regs *regs)
19{ 19{
20 if (regs->trap != __LC_SVC_OLD_PSW) 20 return regs->svcnr ? regs->svcnr : -1;
21 return -1;
22 return regs->gprs[2];
23} 21}
24 22
25static inline void syscall_rollback(struct task_struct *task, 23static inline void syscall_rollback(struct task_struct *task,
@@ -52,18 +50,20 @@ static inline void syscall_get_arguments(struct task_struct *task,
52 unsigned int i, unsigned int n, 50 unsigned int i, unsigned int n,
53 unsigned long *args) 51 unsigned long *args)
54{ 52{
53 unsigned long mask = -1UL;
54
55 BUG_ON(i + n > 6); 55 BUG_ON(i + n > 6);
56#ifdef CONFIG_COMPAT 56#ifdef CONFIG_COMPAT
57 if (test_tsk_thread_flag(task, TIF_31BIT)) { 57 if (test_tsk_thread_flag(task, TIF_31BIT))
58 if (i + n == 6) 58 mask = 0xffffffff;
59 args[--n] = (u32) regs->args[0];
60 while (n-- > 0)
61 args[n] = (u32) regs->gprs[2 + i + n];
62 }
63#endif 59#endif
64 if (i + n == 6) 60 if (i + n == 6)
65 args[--n] = regs->args[0]; 61 args[--n] = regs->args[0] & mask;
66 memcpy(args, &regs->gprs[2 + i], n * sizeof(args[0])); 62 while (n-- > 0)
63 if (i + n > 0)
64 args[n] = regs->gprs[2 + i + n] & mask;
65 if (i == 0)
66 args[0] = regs->orig_gpr2 & mask;
67} 67}
68 68
69static inline void syscall_set_arguments(struct task_struct *task, 69static inline void syscall_set_arguments(struct task_struct *task,
@@ -74,7 +74,11 @@ static inline void syscall_set_arguments(struct task_struct *task,
74 BUG_ON(i + n > 6); 74 BUG_ON(i + n > 6);
75 if (i + n == 6) 75 if (i + n == 6)
76 regs->args[0] = args[--n]; 76 regs->args[0] = args[--n];
77 memcpy(&regs->gprs[2 + i], args, n * sizeof(args[0])); 77 while (n-- > 0)
78 if (i + n > 0)
79 regs->gprs[2 + i + n] = args[n];
80 if (i == 0)
81 regs->orig_gpr2 = args[0];
78} 82}
79 83
80#endif /* _ASM_SYSCALL_H */ 84#endif /* _ASM_SYSCALL_H */