1 /* Return -1 on error or 1 on success (never 0!). */
2 static int
get_syscall_args(struct tcb * tcp)3 get_syscall_args(struct tcb *tcp)
4 {
5 	if (tcp->currpers == 1) {
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) sparc_regs.u_regs[U_REG_O0 + 0];
13 		tcp->u_arg[1] = (uint32_t) sparc_regs.u_regs[U_REG_O0 + 1];
14 		tcp->u_arg[2] = (uint32_t) sparc_regs.u_regs[U_REG_O0 + 2];
15 		tcp->u_arg[3] = (uint32_t) sparc_regs.u_regs[U_REG_O0 + 3];
16 		tcp->u_arg[4] = (uint32_t) sparc_regs.u_regs[U_REG_O0 + 4];
17 		tcp->u_arg[5] = (uint32_t) sparc_regs.u_regs[U_REG_O0 + 5];
18 	} else {
19 		tcp->u_arg[0] = sparc_regs.u_regs[U_REG_O0 + 0];
20 		tcp->u_arg[1] = sparc_regs.u_regs[U_REG_O0 + 1];
21 		tcp->u_arg[2] = sparc_regs.u_regs[U_REG_O0 + 2];
22 		tcp->u_arg[3] = sparc_regs.u_regs[U_REG_O0 + 3];
23 		tcp->u_arg[4] = sparc_regs.u_regs[U_REG_O0 + 4];
24 		tcp->u_arg[5] = sparc_regs.u_regs[U_REG_O0 + 5];
25 	}
26 
27 	return 1;
28 }
29