Dmitry V. Levin | d70d1c4 | 2015-03-22 22:13:55 +0000 | [diff] [blame] | 1 | /* |
| 2 | * In X32, return value is 64-bit (llseek uses one). |
| 3 | * Using merely "long rax" would not work. |
| 4 | */ |
| 5 | long long rax; |
| 6 | |
| 7 | if (x86_io.iov_len == sizeof(i386_regs)) { |
| 8 | /* Sign extend from 32 bits */ |
| 9 | rax = (int32_t) i386_regs.eax; |
| 10 | } else { |
| 11 | rax = x86_64_regs.rax; |
| 12 | } |
| 13 | |
| 14 | if (check_errno && is_negated_errno(rax)) { |
| 15 | tcp->u_rval = -1; |
| 16 | tcp->u_error = -rax; |
| 17 | } else { |
| 18 | tcp->u_rval = rax; |
| 19 | # ifdef X32 |
| 20 | /* tcp->u_rval contains a truncated value */ |
| 21 | tcp->u_lrval = rax; |
| 22 | # endif |
| 23 | } |