File: get_syscall_args.c

package info (click to toggle)
strace 4.15-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 22,752 kB
  • ctags: 9,462
  • sloc: ansic: 62,976; sh: 7,256; makefile: 3,551; perl: 352; awk: 343; lisp: 44; sed: 6
file content (34 lines) | stat: -rw-r--r-- 993 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* Return -1 on error or 1 on success (never 0!). */
static int
get_syscall_args(struct tcb *tcp)
{
#if defined LINUX_MIPSN64
	tcp->u_arg[0] = mips_REG_A0;
	tcp->u_arg[1] = mips_REG_A1;
	tcp->u_arg[2] = mips_REG_A2;
	tcp->u_arg[3] = mips_REG_A3;
	tcp->u_arg[4] = mips_REG_A4;
	tcp->u_arg[5] = mips_REG_A5;
#elif defined LINUX_MIPSN32
	tcp->u_arg[0] = tcp->ext_arg[0] = mips_REG_A0;
	tcp->u_arg[1] = tcp->ext_arg[1] = mips_REG_A1;
	tcp->u_arg[2] = tcp->ext_arg[2] = mips_REG_A2;
	tcp->u_arg[3] = tcp->ext_arg[3] = mips_REG_A3;
	tcp->u_arg[4] = tcp->ext_arg[4] = mips_REG_A4;
	tcp->u_arg[5] = tcp->ext_arg[5] = mips_REG_A5;
#elif defined LINUX_MIPSO32
	tcp->u_arg[0] = mips_REG_A0;
	tcp->u_arg[1] = mips_REG_A1;
	tcp->u_arg[2] = mips_REG_A2;
	tcp->u_arg[3] = mips_REG_A3;
	if (tcp->s_ent->nargs > 4) {
		if (umoven(tcp, mips_REG_SP + 4 * 4,
			   (tcp->s_ent->nargs - 4) * sizeof(tcp->u_arg[0]),
			   &tcp->u_arg[4]) < 0)
			return -1;
	}
#else
# error unsupported mips abi
#endif
	return 1;
}