blob: 1c91c0acfd8d9e482a77e7de54e573efe62518d2 [file] [log] [blame]
Dmitry V. Levin0c8c5c92015-11-29 00:06:45 +00001static void
2get_error(struct tcb *tcp, const bool check_errno)
3{
4 /*
5 * The system call convention specifies that r2 contains the return
6 * value on success or a positive error number on failure. A flag
7 * indicating successful completion is written to r7; r7=0 indicates
8 * the system call success, r7=1 indicates an error. The positive
9 * errno value written in r2.
10 */
Dmitry V. Levin552f2f62015-12-27 00:18:51 +000011 if (nios2_regs.regs[7]) {
Dmitry V. Levin0c8c5c92015-11-29 00:06:45 +000012 tcp->u_rval = -1;
13 tcp->u_error = nios2_regs.regs[2];
14 } else {
15 tcp->u_rval = nios2_regs.regs[2];
16 }
Ezequiel Garciabd8dd772015-04-18 17:33:27 -030017}