• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef HAVE_GETREGS_OLD
2 # define arch_set_error i386_set_error
3 # define arch_set_success i386_set_success
4 # include "i386/set_error.c"
5 # undef arch_set_success
6 # undef arch_set_error
7 #endif /* !HAVE_GETREGS_OLD */
8 
9 static int
arch_set_error(struct tcb * tcp)10 arch_set_error(struct tcb *tcp)
11 {
12 #ifdef HAVE_GETREGS_OLD
13 	kernel_ulong_t	rval = -(kernel_long_t) tcp->u_error;
14 
15 	if (x86_io.iov_len == sizeof(i386_regs))
16 		i386_regs.eax = rval;
17 	else
18 		x86_64_regs.rax = rval;
19 
20 	return upoke(tcp, 8 * RAX, rval);
21 #else
22 	if (x86_io.iov_len == sizeof(i386_regs))
23 		return i386_set_error(tcp);
24 
25 	x86_64_regs.rax = -(kernel_long_t) tcp->u_error;
26 	return set_regs(tcp->pid);
27 #endif
28 }
29 
30 static int
arch_set_success(struct tcb * tcp)31 arch_set_success(struct tcb *tcp)
32 {
33 #ifdef HAVE_GETREGS_OLD
34 	kernel_ulong_t  rval = (kernel_ulong_t) tcp->u_rval;
35 
36 	if (x86_io.iov_len == sizeof(i386_regs))
37 		i386_regs.eax = rval;
38 	else
39 		x86_64_regs.rax = rval;
40 
41 	return upoke(tcp, 8 * RAX, rval);
42 #else
43 	if (x86_io.iov_len == sizeof(i386_regs))
44 		return i386_set_success(tcp);
45 
46 	x86_64_regs.rax = (kernel_ulong_t) tcp->u_rval;
47 	return set_regs(tcp->pid);
48 #endif
49 }
50