Lines 235-240
static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \
Link Here
|
235 |
#define __NR_sys_getcwd1 __NR_getcwd |
235 |
#define __NR_sys_getcwd1 __NR_getcwd |
236 |
#define __NR_sys_getdents __NR_getdents |
236 |
#define __NR_sys_getdents __NR_getdents |
237 |
#define __NR_sys_getdents64 __NR_getdents64 |
237 |
#define __NR_sys_getdents64 __NR_getdents64 |
|
|
238 |
#define __NR_sys_getdents64_x32 __NR_getdents64_x32 |
238 |
#define __NR_sys_getpriority __NR_getpriority |
239 |
#define __NR_sys_getpriority __NR_getpriority |
239 |
#define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo |
240 |
#define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo |
240 |
#define __NR_sys_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo |
241 |
#define __NR_sys_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo |
Lines 275-280
_syscall3(int, sys_getdents, uint, fd, struct linux_dirent *, dirp, uint, count)
Link Here
|
275 |
(defined(TARGET_NR_getdents64) && defined(__NR_getdents64)) |
276 |
(defined(TARGET_NR_getdents64) && defined(__NR_getdents64)) |
276 |
_syscall3(int, sys_getdents64, uint, fd, struct linux_dirent64 *, dirp, uint, count); |
277 |
_syscall3(int, sys_getdents64, uint, fd, struct linux_dirent64 *, dirp, uint, count); |
277 |
#endif |
278 |
#endif |
|
|
279 |
#if (defined(TARGET_NR_getdents) && \ |
280 |
!defined(EMULATE_GETDENTS_WITH_GETDENTS)) || \ |
281 |
(defined(TARGET_NR_getdents64_x32) && defined(__NR_getdents64_x32)) |
282 |
_syscall3(int, sys_getdents64_x32, uint, fd, struct linux_dirent64 *, dirp, uint, count); |
283 |
#endif |
278 |
#if defined(TARGET_NR__llseek) && defined(__NR_llseek) |
284 |
#if defined(TARGET_NR__llseek) && defined(__NR_llseek) |
279 |
_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, |
285 |
_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, |
280 |
loff_t *, res, uint, wh); |
286 |
loff_t *, res, uint, wh); |
Lines 1062-1068
static inline rlim_t target_to_host_rlim(abi_ulong target_rlim)
Link Here
|
1062 |
{ |
1068 |
{ |
1063 |
abi_ulong target_rlim_swap; |
1069 |
abi_ulong target_rlim_swap; |
1064 |
rlim_t result; |
1070 |
rlim_t result; |
1065 |
|
1071 |
|
1066 |
target_rlim_swap = tswapal(target_rlim); |
1072 |
target_rlim_swap = tswapal(target_rlim); |
1067 |
if (target_rlim_swap == TARGET_RLIM_INFINITY) |
1073 |
if (target_rlim_swap == TARGET_RLIM_INFINITY) |
1068 |
return RLIM_INFINITY; |
1074 |
return RLIM_INFINITY; |
Lines 1070-1076
static inline rlim_t target_to_host_rlim(abi_ulong target_rlim)
Link Here
|
1070 |
result = target_rlim_swap; |
1076 |
result = target_rlim_swap; |
1071 |
if (target_rlim_swap != (rlim_t)result) |
1077 |
if (target_rlim_swap != (rlim_t)result) |
1072 |
return RLIM_INFINITY; |
1078 |
return RLIM_INFINITY; |
1073 |
|
1079 |
|
1074 |
return result; |
1080 |
return result; |
1075 |
} |
1081 |
} |
1076 |
|
1082 |
|
Lines 1078-1090
static inline abi_ulong host_to_target_rlim(rlim_t rlim)
Link Here
|
1078 |
{ |
1084 |
{ |
1079 |
abi_ulong target_rlim_swap; |
1085 |
abi_ulong target_rlim_swap; |
1080 |
abi_ulong result; |
1086 |
abi_ulong result; |
1081 |
|
1087 |
|
1082 |
if (rlim == RLIM_INFINITY || rlim != (abi_long)rlim) |
1088 |
if (rlim == RLIM_INFINITY || rlim != (abi_long)rlim) |
1083 |
target_rlim_swap = TARGET_RLIM_INFINITY; |
1089 |
target_rlim_swap = TARGET_RLIM_INFINITY; |
1084 |
else |
1090 |
else |
1085 |
target_rlim_swap = rlim; |
1091 |
target_rlim_swap = rlim; |
1086 |
result = tswapal(target_rlim_swap); |
1092 |
result = tswapal(target_rlim_swap); |
1087 |
|
1093 |
|
1088 |
return result; |
1094 |
return result; |
1089 |
} |
1095 |
} |
1090 |
|
1096 |
|
Lines 1526-1534
static inline abi_long target_to_host_cmsg(struct msghdr *msgh,
Link Here
|
1526 |
abi_ulong target_cmsg_addr; |
1532 |
abi_ulong target_cmsg_addr; |
1527 |
struct target_cmsghdr *target_cmsg, *target_cmsg_start; |
1533 |
struct target_cmsghdr *target_cmsg, *target_cmsg_start; |
1528 |
socklen_t space = 0; |
1534 |
socklen_t space = 0; |
1529 |
|
1535 |
|
1530 |
msg_controllen = tswapal(target_msgh->msg_controllen); |
1536 |
msg_controllen = tswapal(target_msgh->msg_controllen); |
1531 |
if (msg_controllen < sizeof (struct target_cmsghdr)) |
1537 |
if (msg_controllen < sizeof (struct target_cmsghdr)) |
1532 |
goto the_end; |
1538 |
goto the_end; |
1533 |
target_cmsg_addr = tswapal(target_msgh->msg_control); |
1539 |
target_cmsg_addr = tswapal(target_msgh->msg_control); |
1534 |
target_cmsg = lock_user(VERIFY_READ, target_cmsg_addr, msg_controllen, 1); |
1540 |
target_cmsg = lock_user(VERIFY_READ, target_cmsg_addr, msg_controllen, 1); |
Lines 1610-1616
static inline abi_long host_to_target_cmsg(struct target_msghdr *target_msgh,
Link Here
|
1610 |
socklen_t space = 0; |
1616 |
socklen_t space = 0; |
1611 |
|
1617 |
|
1612 |
msg_controllen = tswapal(target_msgh->msg_controllen); |
1618 |
msg_controllen = tswapal(target_msgh->msg_controllen); |
1613 |
if (msg_controllen < sizeof (struct target_cmsghdr)) |
1619 |
if (msg_controllen < sizeof (struct target_cmsghdr)) |
1614 |
goto the_end; |
1620 |
goto the_end; |
1615 |
target_cmsg_addr = tswapal(target_msgh->msg_control); |
1621 |
target_cmsg_addr = tswapal(target_msgh->msg_control); |
1616 |
target_cmsg = lock_user(VERIFY_WRITE, target_cmsg_addr, msg_controllen, 0); |
1622 |
target_cmsg = lock_user(VERIFY_WRITE, target_cmsg_addr, msg_controllen, 0); |
Lines 5592-5598
abi_long do_set_thread_area(CPUX86State *env, abi_ulong ptr)
Link Here
|
5592 |
} |
5598 |
} |
5593 |
unlock_user_struct(target_ldt_info, ptr, 1); |
5599 |
unlock_user_struct(target_ldt_info, ptr, 1); |
5594 |
|
5600 |
|
5595 |
if (ldt_info.entry_number < TARGET_GDT_ENTRY_TLS_MIN || |
5601 |
if (ldt_info.entry_number < TARGET_GDT_ENTRY_TLS_MIN || |
5596 |
ldt_info.entry_number > TARGET_GDT_ENTRY_TLS_MAX) |
5602 |
ldt_info.entry_number > TARGET_GDT_ENTRY_TLS_MAX) |
5597 |
return -TARGET_EINVAL; |
5603 |
return -TARGET_EINVAL; |
5598 |
seg_32bit = ldt_info.flags & 1; |
5604 |
seg_32bit = ldt_info.flags & 1; |
Lines 5670-5676
static abi_long do_get_thread_area(CPUX86State *env, abi_ulong ptr)
Link Here
|
5670 |
lp = (uint32_t *)(gdt_table + idx); |
5676 |
lp = (uint32_t *)(gdt_table + idx); |
5671 |
entry_1 = tswap32(lp[0]); |
5677 |
entry_1 = tswap32(lp[0]); |
5672 |
entry_2 = tswap32(lp[1]); |
5678 |
entry_2 = tswap32(lp[1]); |
5673 |
|
5679 |
|
5674 |
read_exec_only = ((entry_2 >> 9) & 1) ^ 1; |
5680 |
read_exec_only = ((entry_2 >> 9) & 1) ^ 1; |
5675 |
contents = (entry_2 >> 10) & 3; |
5681 |
contents = (entry_2 >> 10) & 3; |
5676 |
seg_not_present = ((entry_2 >> 15) & 1) ^ 1; |
5682 |
seg_not_present = ((entry_2 >> 15) & 1) ^ 1; |
Lines 5686-5693
static abi_long do_get_thread_area(CPUX86State *env, abi_ulong ptr)
Link Here
|
5686 |
(read_exec_only << 3) | (limit_in_pages << 4) | |
5692 |
(read_exec_only << 3) | (limit_in_pages << 4) | |
5687 |
(seg_not_present << 5) | (useable << 6) | (lm << 7); |
5693 |
(seg_not_present << 5) | (useable << 6) | (lm << 7); |
5688 |
limit = (entry_1 & 0xffff) | (entry_2 & 0xf0000); |
5694 |
limit = (entry_1 & 0xffff) | (entry_2 & 0xf0000); |
5689 |
base_addr = (entry_1 >> 16) | |
5695 |
base_addr = (entry_1 >> 16) | |
5690 |
(entry_2 & 0xff000000) | |
5696 |
(entry_2 & 0xff000000) | |
5691 |
((entry_2 & 0xff) << 16); |
5697 |
((entry_2 & 0xff) << 16); |
5692 |
target_ldt_info->base_addr = tswapal(base_addr); |
5698 |
target_ldt_info->base_addr = tswapal(base_addr); |
5693 |
target_ldt_info->limit = tswap32(limit); |
5699 |
target_ldt_info->limit = tswap32(limit); |
Lines 9619-9624
static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
Link Here
|
9619 |
} |
9625 |
} |
9620 |
return ret; |
9626 |
return ret; |
9621 |
#endif /* TARGET_NR_getdents64 */ |
9627 |
#endif /* TARGET_NR_getdents64 */ |
|
|
9628 |
#if defined(TARGET_NR_getdents64_x32) && defined(__NR_getdents64_x32) |
9629 |
case TARGET_NR_getdents64_x32: |
9630 |
{ |
9631 |
struct linux_dirent64 *dirp; |
9632 |
abi_long count = arg3; |
9633 |
if (!(dirp = lock_user(VERIFY_WRITE, arg2, count, 0))) |
9634 |
return -TARGET_EFAULT; |
9635 |
ret = get_errno(sys_getdents64_x32(arg1, dirp, count)); |
9636 |
if (!is_error(ret)) { |
9637 |
struct linux_dirent64 *de; |
9638 |
int len = ret; |
9639 |
int reclen; |
9640 |
de = dirp; |
9641 |
while (len > 0) { |
9642 |
reclen = de->d_reclen; |
9643 |
if (reclen > len) |
9644 |
break; |
9645 |
de->d_reclen = tswap16(reclen); |
9646 |
tswap64s((uint64_t *)&de->d_ino); |
9647 |
tswap64s((uint64_t *)&de->d_off); |
9648 |
de = (struct linux_dirent64 *)((char *)de + reclen); |
9649 |
len -= reclen; |
9650 |
} |
9651 |
} |
9652 |
unlock_user(dirp, arg2, ret); |
9653 |
} |
9654 |
return ret; |
9655 |
#endif /* TARGET_NR_getdents64_x32 */ |
9622 |
#if defined(TARGET_NR__newselect) |
9656 |
#if defined(TARGET_NR__newselect) |
9623 |
case TARGET_NR__newselect: |
9657 |
case TARGET_NR__newselect: |
9624 |
return do_select(arg1, arg2, arg3, arg4, arg5); |
9658 |
return do_select(arg1, arg2, arg3, arg4, arg5); |
Lines 10554-10560
static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
Link Here
|
10554 |
return get_errno(fchown(arg1, low2highuid(arg2), low2highgid(arg3))); |
10588 |
return get_errno(fchown(arg1, low2highuid(arg2), low2highgid(arg3))); |
10555 |
#if defined(TARGET_NR_fchownat) |
10589 |
#if defined(TARGET_NR_fchownat) |
10556 |
case TARGET_NR_fchownat: |
10590 |
case TARGET_NR_fchownat: |
10557 |
if (!(p = lock_user_string(arg2))) |
10591 |
if (!(p = lock_user_string(arg2))) |
10558 |
return -TARGET_EFAULT; |
10592 |
return -TARGET_EFAULT; |
10559 |
ret = get_errno(fchownat(arg1, p, low2highuid(arg3), |
10593 |
ret = get_errno(fchownat(arg1, p, low2highuid(arg3), |
10560 |
low2highgid(arg4), arg5)); |
10594 |
low2highgid(arg4), arg5)); |