• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 static void
get_error(struct tcb * tcp,const bool check_errno)2 get_error(struct tcb *tcp, const bool check_errno)
3 {
4 	/*
5 	 * In X32, return value is 64-bit (llseek uses one).
6 	 * Using merely "long rax" would not work.
7 	 */
8 	long long rax;
9 
10 	if (x86_io.iov_len == sizeof(i386_regs)) {
11 		/* Sign extend from 32 bits */
12 		rax = (int32_t) i386_regs.eax;
13 	} else {
14 		rax = x86_64_regs.rax;
15 	}
16 
17 	if (check_errno && is_negated_errno(rax)) {
18 		tcp->u_rval = -1;
19 		tcp->u_error = -rax;
20 	} else {
21 		tcp->u_rval = rax;
22 #ifdef X32
23 		/* tcp->u_rval contains a truncated value */
24 		tcp->u_lrval = rax;
25 #endif
26 	}
27 }
28