Dmitry V. Levin | 0c8c5c9 | 2015-11-29 00:06:45 +0000 | [diff] [blame] | 1 | static void |
| 2 | get_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. Levin | 552f2f6 | 2015-12-27 00:18:51 +0000 | [diff] [blame] | 11 | if (nios2_regs.regs[7]) { |
Dmitry V. Levin | 0c8c5c9 | 2015-11-29 00:06:45 +0000 | [diff] [blame] | 12 | tcp->u_rval = -1; |
| 13 | tcp->u_error = nios2_regs.regs[2]; |
| 14 | } else { |
| 15 | tcp->u_rval = nios2_regs.regs[2]; |
| 16 | } |
Ezequiel Garcia | bd8dd77 | 2015-04-18 17:33:27 -0300 | [diff] [blame] | 17 | } |