• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 defined LINUX_MIPSN64 || defined LINUX_MIPSN32
6 	tcp->u_arg[0] = mips_REG_A0;
7 	tcp->u_arg[1] = mips_REG_A1;
8 	tcp->u_arg[2] = mips_REG_A2;
9 	tcp->u_arg[3] = mips_REG_A3;
10 	tcp->u_arg[4] = mips_REG_A4;
11 	tcp->u_arg[5] = mips_REG_A5;
12 #elif defined LINUX_MIPSO32
13 	tcp->u_arg[0] = mips_REG_A0;
14 	tcp->u_arg[1] = mips_REG_A1;
15 	tcp->u_arg[2] = mips_REG_A2;
16 	tcp->u_arg[3] = mips_REG_A3;
17 	if (tcp->s_ent->nargs > 4
18 	    && umoven(tcp, mips_REG_SP + 4 * sizeof(tcp->u_arg[0]),
19 		      (tcp->s_ent->nargs - 4) * sizeof(tcp->u_arg[0]),
20 		      &tcp->u_arg[4]) < 0) {
21 		/*
22 		 * Let's proceed with the first 4 arguments
23 		 * instead of reporting the failure.
24 		 */
25 		memset(&tcp->u_arg[4], 0,
26 		       (tcp->s_ent->nargs - 4) * sizeof(tcp->u_arg[0]));
27 	}
28 #else
29 # error unsupported mips abi
30 #endif
31 	return 1;
32 }
33