static void
get_error(struct tcb *tcp, const bool check_errno)
{
	/*
	 * In X32, return value is 64-bit (llseek uses one).
	 * Using merely "long rax" would not work.
	 */
	long long rax;

	if (x86_io.iov_len == sizeof(i386_regs)) {
		/* Sign extend from 32 bits */
		rax = (int32_t) i386_regs.eax;
	} else {
		rax = x86_64_regs.rax;
	}

	if (check_errno && is_negated_errno(rax)) {
		tcp->u_rval = -1;
		tcp->u_error = -rax;
	} else {
		tcp->u_rval = rax;
#ifdef X32
		/* tcp->u_rval contains a truncated value */
		tcp->u_lrval = rax;
#endif
	}
}
static void
get_error(struct tcb *tcp, const bool check_errno)
{
	if (check_errno && is_negated_errno(sh_r0)) {
		tcp->u_rval = -1;
		tcp->u_error = -sh_r0;
	} else {
		tcp->u_rval = sh_r0;
	}
}
Esempio n. 3
0
static void
get_error(struct tcb *tcp, const bool check_errno)
{
	if (check_errno && is_negated_errno(m68k_regs.d0)) {
		tcp->u_rval = -1;
		tcp->u_error = -m68k_regs.d0;
	} else {
		tcp->u_rval = m68k_regs.d0;
	}
}
Esempio n. 4
0
static void
get_error(struct tcb *tcp, const bool check_errno)
{
	if (check_errno && is_negated_errno(microblaze_r3)) {
		tcp->u_rval = -1;
		tcp->u_error = -microblaze_r3;
	} else {
		tcp->u_rval = microblaze_r3;
	}
}
Esempio n. 5
0
static void
get_error(struct tcb *tcp, const bool check_errno)
{
	if (check_errno && is_negated_errno(riscv_regs.a0)) {
		tcp->u_rval = -1;
		tcp->u_error = -riscv_regs.a0;
	} else {
		tcp->u_rval = riscv_regs.a0;
	}
}
Esempio n. 6
0
static void
get_error(struct tcb *tcp, const bool check_errno)
{
	/*
	 * The standard tile calling convention returns the value
	 * (or negative errno) in r0, and zero (or positive errno) in r1.
	 * Until at least kernel 3.8, however, the r1 value is not
	 * reflected in ptregs at this point, so we use r0 here.
	 */
	if (check_errno && is_negated_errno(tile_regs.regs[0])) {
		tcp->u_rval = -1;
		tcp->u_error = -tile_regs.regs[0];
	} else {
		tcp->u_rval = tile_regs.regs[0];
	}
}
Esempio n. 7
0
static void
get_error(struct tcb *tcp, const bool check_errno)
{
	if (ia64_ia32mode) {
		int err = ia64_regs.gr[8];
		if (check_errno && is_negated_errno(err)) {
			tcp->u_rval = -1;
			tcp->u_error = -err;
		} else {
			tcp->u_rval = err;
		}
	} else {
		if (ia64_regs.gr[10]) {
			tcp->u_rval = -1;
			tcp->u_error = ia64_regs.gr[8];
		} else {
			tcp->u_rval = ia64_regs.gr[8];
		}
	}
}