strace/linux/nios2/get_error.c
Dmitry V. Levin 552f2f62fd alpha, ia64, mips, nios2, powerpc, sparc: always check for syscall error
On architectures that use dedicated registers to report syscall errors,
check for syscall error condition regardless of SYSCALL_NEVER_FAILS flag
in the syscall entry.  On architectures that use negated errno
semantics, there is no way to distinguish a syscall error from a valid
return code that looks like a syscall error, and the check for
SYSCALL_NEVER_FAILS flag remains the only way to tell one case
from another.

* linux/alpha/get_error.c (get_error): Ignore check_errno.
* linux/ia64/get_error.c: Likewise.
* linux/mips/get_error.c: Likewise.
* linux/nios2/get_error.c: Likewise.
* linux/powerpc/get_error.c: Likewise.
* linux/sparc/get_error.c: Likewise.
* linux/sparc64/get_error.c: Likewise.
2015-12-27 01:02:53 +00:00

18 lines
515 B
C

static void
get_error(struct tcb *tcp, const bool check_errno)
{
/*
* The system call convention specifies that r2 contains the return
* value on success or a positive error number on failure. A flag
* indicating successful completion is written to r7; r7=0 indicates
* the system call success, r7=1 indicates an error. The positive
* errno value written in r2.
*/
if (nios2_regs.regs[7]) {
tcp->u_rval = -1;
tcp->u_error = nios2_regs.regs[2];
} else {
tcp->u_rval = nios2_regs.regs[2];
}
}