From 7843fe51d664fc94d8808b3e4c4a6bccb0c481c3 Mon Sep 17 00:00:00 2001 From: David Smith Date: Thu, 16 Apr 2009 12:25:24 -0500 Subject: Improved ppc and ia64 runtime/syscall.h. 2009-04-16 David Smith * syscall.h (syscall_get_arguments): Fixed sign extension for 32-bit processes on ppc64. (__ia64_syscall_get_arguments): Calls ia64_fetch_register() to handle NULL values. Corrected register numbers. --- runtime/syscall.h | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'runtime/syscall.h') diff --git a/runtime/syscall.h b/runtime/syscall.h index 6d22ba83..5e538389 100644 --- a/runtime/syscall.h +++ b/runtime/syscall.h @@ -124,7 +124,7 @@ syscall_get_nr(struct task_struct *task, struct pt_regs *regs) static inline long syscall_get_nr(struct task_struct *task, struct pt_regs *regs) { - return regs->r15; + return regs->r15; } #endif @@ -304,6 +304,17 @@ syscall_get_arguments(struct task_struct *task, struct pt_regs *regs, _stp_error("invalid syscall arg request"); return; } +#ifdef CONFIG_PPC64 + if (test_tsk_thread_flag(task, TIF_32BIT)) { + /* + * Zero-extend 32-bit argument values. The high bits are + * garbage ignored by the actual syscall dispatch. + */ + while (n-- > 0) + args[n] = (u32) regs->gpr[3 + i + n]; + return; + } +#endif memcpy(args, ®s->gpr[3 + i], n * sizeof(args[0])); } #endif @@ -324,22 +335,22 @@ __ia64_syscall_get_arguments(struct task_struct *task, struct pt_regs *regs, switch (i) { case 0: if (!n--) break; - *args++ = *__ia64_fetch_register(i + 32, regs, cache); + *args++ = ia64_fetch_register(32, regs, cache); case 1: if (!n--) break; - *args++ = *__ia64_fetch_register(i + 33, regs, cache); + *args++ = ia64_fetch_register(33, regs, cache); case 2: if (!n--) break; - *args++ = *__ia64_fetch_register(i + 34, regs, cache); + *args++ = ia64_fetch_register(34, regs, cache); case 3: if (!n--) break; - *args++ = *__ia64_fetch_register(i + 35, regs, cache); + *args++ = ia64_fetch_register(35, regs, cache); case 4: if (!n--) break; - *args++ = *__ia64_fetch_register(i + 36, regs, cache); + *args++ = ia64_fetch_register(36, regs, cache); case 5: if (!n--) break; - *args++ = *__ia64_fetch_register(i + 37, regs, cache); + *args++ = ia64_fetch_register(37, regs, cache); } } #endif -- cgit