Files
rk35xx-android14/external/strace/linux/tile/get_error.c
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

19 lines
512 B
C

#include "negated_errno.h"
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];
}
}