blob: 29b78163e690c4462919107f19c1fe816ca2999a [file] [log] [blame]
Dmitry V. Levind70d1c42015-03-22 22:13:55 +00001/*
2 * In X32, return value is 64-bit (llseek uses one).
3 * Using merely "long rax" would not work.
4 */
5long long rax;
6
7if (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
14if (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}