• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "negated_errno.h"
2 
3 static void
get_error(struct tcb * tcp,const bool check_errno)4 get_error(struct tcb *tcp, const bool check_errno)
5 {
6 	/*
7 	 * The standard tile calling convention returns the value
8 	 * (or negative errno) in r0, and zero (or positive errno) in r1.
9 	 * Until at least kernel 3.8, however, the r1 value is not
10 	 * reflected in ptregs at this point, so we use r0 here.
11 	 */
12 	if (check_errno && is_negated_errno(tile_regs.regs[0])) {
13 		tcp->u_rval = -1;
14 		tcp->u_error = -tile_regs.regs[0];
15 	} else {
16 		tcp->u_rval = tile_regs.regs[0];
17 	}
18 }
19