aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/syscall.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/include/asm/syscall.h')
-rw-r--r--arch/powerpc/include/asm/syscall.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h
index 403e2303fe18..8d79a87c0511 100644
--- a/arch/powerpc/include/asm/syscall.h
+++ b/arch/powerpc/include/asm/syscall.h
@@ -64,7 +64,7 @@ static inline void syscall_get_arguments(struct task_struct *task,
64 unsigned int i, unsigned int n, 64 unsigned int i, unsigned int n,
65 unsigned long *args) 65 unsigned long *args)
66{ 66{
67 unsigned long mask = -1UL; 67 unsigned long val, mask = -1UL;
68 68
69 BUG_ON(i + n > 6); 69 BUG_ON(i + n > 6);
70 70
@@ -72,8 +72,14 @@ static inline void syscall_get_arguments(struct task_struct *task,
72 if (test_tsk_thread_flag(task, TIF_32BIT)) 72 if (test_tsk_thread_flag(task, TIF_32BIT))
73 mask = 0xffffffff; 73 mask = 0xffffffff;
74#endif 74#endif
75 while (n--) 75 while (n--) {
76 args[n] = regs->gpr[3 + i + n] & mask; 76 if (n == 0 && i == 0)
77 val = regs->orig_gpr3;
78 else
79 val = regs->gpr[3 + i + n];
80
81 args[n] = val & mask;
82 }
77} 83}
78 84
79static inline void syscall_set_arguments(struct task_struct *task, 85static inline void syscall_set_arguments(struct task_struct *task,
@@ -83,6 +89,10 @@ static inline void syscall_set_arguments(struct task_struct *task,
83{ 89{
84 BUG_ON(i + n > 6); 90 BUG_ON(i + n > 6);
85 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0])); 91 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0]));
92
93 /* Also copy the first argument into orig_gpr3 */
94 if (i == 0 && n > 0)
95 regs->orig_gpr3 = args[0];
86} 96}
87 97
88static inline int syscall_get_arch(void) 98static inline int syscall_get_arch(void)