aboutsummaryrefslogtreecommitdiff
path: root/linux/powerpc/get_syscall_args.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/powerpc/get_syscall_args.c')
-rw-r--r--linux/powerpc/get_syscall_args.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/linux/powerpc/get_syscall_args.c b/linux/powerpc/get_syscall_args.c
index 66bcae31f..b54377efc 100644
--- a/linux/powerpc/get_syscall_args.c
+++ b/linux/powerpc/get_syscall_args.c
@@ -2,11 +2,26 @@
static int
get_syscall_args(struct tcb *tcp)
{
- tcp->u_arg[0] = ppc_regs.orig_gpr3;
- tcp->u_arg[1] = ppc_regs.gpr[4];
- tcp->u_arg[2] = ppc_regs.gpr[5];
- tcp->u_arg[3] = ppc_regs.gpr[6];
- tcp->u_arg[4] = ppc_regs.gpr[7];
- tcp->u_arg[5] = ppc_regs.gpr[8];
+ if (current_personality != 0) {
+ /*
+ * Zero-extend from 32 bits.
+ * Use truncate_klong_to_current_wordsize(tcp->u_arg[N])
+ * in syscall handlers
+ * if you need to use *sign-extended* parameter.
+ */
+ tcp->u_arg[0] = (uint32_t) ppc_regs.orig_gpr3;
+ tcp->u_arg[1] = (uint32_t) ppc_regs.gpr[4];
+ tcp->u_arg[2] = (uint32_t) ppc_regs.gpr[5];
+ tcp->u_arg[3] = (uint32_t) ppc_regs.gpr[6];
+ tcp->u_arg[4] = (uint32_t) ppc_regs.gpr[7];
+ tcp->u_arg[5] = (uint32_t) ppc_regs.gpr[8];
+ } else {
+ tcp->u_arg[0] = ppc_regs.orig_gpr3;
+ tcp->u_arg[1] = ppc_regs.gpr[4];
+ tcp->u_arg[2] = ppc_regs.gpr[5];
+ tcp->u_arg[3] = ppc_regs.gpr[6];
+ tcp->u_arg[4] = ppc_regs.gpr[7];
+ tcp->u_arg[5] = ppc_regs.gpr[8];
+ }
return 1;
}