1 /* Return -1 on error or 1 on success (never 0!). */ 2 static int get_syscall_args(struct tcb * tcp)3get_syscall_args(struct tcb *tcp) 4 { 5 if (current_personality != 0) { 6 /* 7 * Zero-extend from 32 bits. 8 * Use truncate_klong_to_current_wordsize(tcp->u_arg[N]) 9 * in syscall handlers 10 * if you need to use *sign-extended* parameter. 11 */ 12 tcp->u_arg[0] = (uint32_t) ppc_regs.orig_gpr3; 13 tcp->u_arg[1] = (uint32_t) ppc_regs.gpr[4]; 14 tcp->u_arg[2] = (uint32_t) ppc_regs.gpr[5]; 15 tcp->u_arg[3] = (uint32_t) ppc_regs.gpr[6]; 16 tcp->u_arg[4] = (uint32_t) ppc_regs.gpr[7]; 17 tcp->u_arg[5] = (uint32_t) ppc_regs.gpr[8]; 18 } else { 19 tcp->u_arg[0] = ppc_regs.orig_gpr3; 20 tcp->u_arg[1] = ppc_regs.gpr[4]; 21 tcp->u_arg[2] = ppc_regs.gpr[5]; 22 tcp->u_arg[3] = ppc_regs.gpr[6]; 23 tcp->u_arg[4] = ppc_regs.gpr[7]; 24 tcp->u_arg[5] = ppc_regs.gpr[8]; 25 } 26 return 1; 27 } 28