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 	 * The standard tile calling convention returns the value
6 	 * (or negative errno) in r0, and zero (or positive errno) in r1.
7 	 * Until at least kernel 3.8, however, the r1 value is not
8 	 * reflected in ptregs at this point, so we use r0 here.
9 	 */
10 	if (check_errno && is_negated_errno(tile_regs.regs[0])) {
11 		tcp->u_rval = -1;
12 		tcp->u_error = -tile_regs.regs[0];
13 	} else {
14 		tcp->u_rval = tile_regs.regs[0];
15 	}
16 }
17