Commit 324071035fd94538bc0f1ab316646cace30814fb
1 parent
9007f0ef
Convert syscall arguments and return value from long to int or target_long.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3241 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
108 additions
and
83 deletions
linux-user/qemu.h
| ... | ... | @@ -126,10 +126,11 @@ int load_flt_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, |
| 126 | 126 | void memcpy_to_target(target_ulong dest, const void *src, |
| 127 | 127 | unsigned long len); |
| 128 | 128 | void target_set_brk(target_ulong new_brk); |
| 129 | -long do_brk(target_ulong new_brk); | |
| 129 | +target_long do_brk(target_ulong new_brk); | |
| 130 | 130 | void syscall_init(void); |
| 131 | -long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, | |
| 132 | - long arg4, long arg5, long arg6); | |
| 131 | +target_long do_syscall(void *cpu_env, int num, target_long arg1, | |
| 132 | + target_long arg2, target_long arg3, target_long arg4, | |
| 133 | + target_long arg5, target_long arg6); | |
| 133 | 134 | void gemu_log(const char *fmt, ...) __attribute__((format(printf,1,2))); |
| 134 | 135 | extern CPUState *global_env; |
| 135 | 136 | void cpu_loop(CPUState *env); | ... | ... |
linux-user/syscall.c
| ... | ... | @@ -366,7 +366,7 @@ static inline int host_to_target_errno(int err) |
| 366 | 366 | return err; |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | -static inline long get_errno(long ret) | |
| 369 | +static inline target_long get_errno(target_long ret) | |
| 370 | 370 | { |
| 371 | 371 | if (ret == -1) |
| 372 | 372 | return -host_to_target_errno(errno); |
| ... | ... | @@ -374,9 +374,9 @@ static inline long get_errno(long ret) |
| 374 | 374 | return ret; |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | -static inline int is_error(long ret) | |
| 377 | +static inline int is_error(target_long ret) | |
| 378 | 378 | { |
| 379 | - return (unsigned long)ret >= (unsigned long)(-4096); | |
| 379 | + return (target_ulong)ret >= (target_ulong)(-4096); | |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | static target_ulong target_brk; |
| ... | ... | @@ -387,10 +387,10 @@ void target_set_brk(target_ulong new_brk) |
| 387 | 387 | target_original_brk = target_brk = HOST_PAGE_ALIGN(new_brk); |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | -long do_brk(target_ulong new_brk) | |
| 390 | +target_long do_brk(target_ulong new_brk) | |
| 391 | 391 | { |
| 392 | 392 | target_ulong brk_page; |
| 393 | - long mapped_addr; | |
| 393 | + target_long mapped_addr; | |
| 394 | 394 | int new_alloc_size; |
| 395 | 395 | |
| 396 | 396 | if (!new_brk) |
| ... | ... | @@ -471,7 +471,7 @@ static inline void host_to_target_fds(target_long *target_fds, |
| 471 | 471 | #define HOST_HZ 100 |
| 472 | 472 | #endif |
| 473 | 473 | |
| 474 | -static inline long host_to_target_clock_t(long ticks) | |
| 474 | +static inline target_long host_to_target_clock_t(long ticks) | |
| 475 | 475 | { |
| 476 | 476 | #if HOST_HZ == TARGET_HZ |
| 477 | 477 | return ticks; |
| ... | ... | @@ -530,15 +530,15 @@ static inline void host_to_target_timeval(target_ulong target_addr, |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | |
| 533 | -static long do_select(long n, | |
| 534 | - target_ulong rfd_p, target_ulong wfd_p, | |
| 535 | - target_ulong efd_p, target_ulong target_tv) | |
| 533 | +static target_long do_select(int n, | |
| 534 | + target_ulong rfd_p, target_ulong wfd_p, | |
| 535 | + target_ulong efd_p, target_ulong target_tv) | |
| 536 | 536 | { |
| 537 | 537 | fd_set rfds, wfds, efds; |
| 538 | 538 | fd_set *rfds_ptr, *wfds_ptr, *efds_ptr; |
| 539 | 539 | target_long *target_rfds, *target_wfds, *target_efds; |
| 540 | 540 | struct timeval tv, *tv_ptr; |
| 541 | - long ret; | |
| 541 | + target_long ret; | |
| 542 | 542 | int ok; |
| 543 | 543 | |
| 544 | 544 | if (rfd_p) { |
| ... | ... | @@ -704,10 +704,11 @@ static inline void host_to_target_cmsg(struct target_msghdr *target_msgh, |
| 704 | 704 | msgh->msg_controllen = tswapl(space); |
| 705 | 705 | } |
| 706 | 706 | |
| 707 | -static long do_setsockopt(int sockfd, int level, int optname, | |
| 708 | - target_ulong optval, socklen_t optlen) | |
| 707 | +static target_long do_setsockopt(int sockfd, int level, int optname, | |
| 708 | + target_ulong optval, socklen_t optlen) | |
| 709 | 709 | { |
| 710 | - int val, ret; | |
| 710 | + target_long ret; | |
| 711 | + int val; | |
| 711 | 712 | |
| 712 | 713 | switch(level) { |
| 713 | 714 | case SOL_TCP: |
| ... | ... | @@ -824,10 +825,11 @@ static long do_setsockopt(int sockfd, int level, int optname, |
| 824 | 825 | return ret; |
| 825 | 826 | } |
| 826 | 827 | |
| 827 | -static long do_getsockopt(int sockfd, int level, int optname, | |
| 828 | - target_ulong optval, target_ulong optlen) | |
| 828 | +static target_long do_getsockopt(int sockfd, int level, int optname, | |
| 829 | + target_ulong optval, target_ulong optlen) | |
| 829 | 830 | { |
| 830 | - int len, lv, val, ret; | |
| 831 | + target_long ret; | |
| 832 | + int len, lv, val; | |
| 831 | 833 | |
| 832 | 834 | switch(level) { |
| 833 | 835 | case TARGET_SOL_SOCKET: |
| ... | ... | @@ -943,7 +945,7 @@ static void unlock_iovec(struct iovec *vec, target_ulong target_addr, |
| 943 | 945 | unlock_user (target_vec, target_addr, 0); |
| 944 | 946 | } |
| 945 | 947 | |
| 946 | -static long do_socket(int domain, int type, int protocol) | |
| 948 | +static target_long do_socket(int domain, int type, int protocol) | |
| 947 | 949 | { |
| 948 | 950 | #if defined(TARGET_MIPS) |
| 949 | 951 | switch(type) { |
| ... | ... | @@ -970,8 +972,8 @@ static long do_socket(int domain, int type, int protocol) |
| 970 | 972 | return get_errno(socket(domain, type, protocol)); |
| 971 | 973 | } |
| 972 | 974 | |
| 973 | -static long do_bind(int sockfd, target_ulong target_addr, | |
| 974 | - socklen_t addrlen) | |
| 975 | +static target_long do_bind(int sockfd, target_ulong target_addr, | |
| 976 | + socklen_t addrlen) | |
| 975 | 977 | { |
| 976 | 978 | void *addr = alloca(addrlen); |
| 977 | 979 | |
| ... | ... | @@ -979,8 +981,8 @@ static long do_bind(int sockfd, target_ulong target_addr, |
| 979 | 981 | return get_errno(bind(sockfd, addr, addrlen)); |
| 980 | 982 | } |
| 981 | 983 | |
| 982 | -static long do_connect(int sockfd, target_ulong target_addr, | |
| 983 | - socklen_t addrlen) | |
| 984 | +static target_long do_connect(int sockfd, target_ulong target_addr, | |
| 985 | + socklen_t addrlen) | |
| 984 | 986 | { |
| 985 | 987 | void *addr = alloca(addrlen); |
| 986 | 988 | |
| ... | ... | @@ -988,10 +990,10 @@ static long do_connect(int sockfd, target_ulong target_addr, |
| 988 | 990 | return get_errno(connect(sockfd, addr, addrlen)); |
| 989 | 991 | } |
| 990 | 992 | |
| 991 | -static long do_sendrecvmsg(int fd, target_ulong target_msg, | |
| 992 | - int flags, int send) | |
| 993 | +static target_long do_sendrecvmsg(int fd, target_ulong target_msg, | |
| 994 | + int flags, int send) | |
| 993 | 995 | { |
| 994 | - long ret; | |
| 996 | + target_long ret; | |
| 995 | 997 | struct target_msghdr *msgp; |
| 996 | 998 | struct msghdr msg; |
| 997 | 999 | int count; |
| ... | ... | @@ -1031,12 +1033,12 @@ static long do_sendrecvmsg(int fd, target_ulong target_msg, |
| 1031 | 1033 | return ret; |
| 1032 | 1034 | } |
| 1033 | 1035 | |
| 1034 | -static long do_accept(int fd, target_ulong target_addr, | |
| 1035 | - target_ulong target_addrlen) | |
| 1036 | +static target_long do_accept(int fd, target_ulong target_addr, | |
| 1037 | + target_ulong target_addrlen) | |
| 1036 | 1038 | { |
| 1037 | 1039 | socklen_t addrlen = tget32(target_addrlen); |
| 1038 | 1040 | void *addr = alloca(addrlen); |
| 1039 | - long ret; | |
| 1041 | + target_long ret; | |
| 1040 | 1042 | |
| 1041 | 1043 | ret = get_errno(accept(fd, addr, &addrlen)); |
| 1042 | 1044 | if (!is_error(ret)) { |
| ... | ... | @@ -1046,12 +1048,12 @@ static long do_accept(int fd, target_ulong target_addr, |
| 1046 | 1048 | return ret; |
| 1047 | 1049 | } |
| 1048 | 1050 | |
| 1049 | -static long do_getpeername(int fd, target_ulong target_addr, | |
| 1050 | - target_ulong target_addrlen) | |
| 1051 | +static target_long do_getpeername(int fd, target_ulong target_addr, | |
| 1052 | + target_ulong target_addrlen) | |
| 1051 | 1053 | { |
| 1052 | 1054 | socklen_t addrlen = tget32(target_addrlen); |
| 1053 | 1055 | void *addr = alloca(addrlen); |
| 1054 | - long ret; | |
| 1056 | + target_long ret; | |
| 1055 | 1057 | |
| 1056 | 1058 | ret = get_errno(getpeername(fd, addr, &addrlen)); |
| 1057 | 1059 | if (!is_error(ret)) { |
| ... | ... | @@ -1061,12 +1063,12 @@ static long do_getpeername(int fd, target_ulong target_addr, |
| 1061 | 1063 | return ret; |
| 1062 | 1064 | } |
| 1063 | 1065 | |
| 1064 | -static long do_getsockname(int fd, target_ulong target_addr, | |
| 1065 | - target_ulong target_addrlen) | |
| 1066 | +static target_long do_getsockname(int fd, target_ulong target_addr, | |
| 1067 | + target_ulong target_addrlen) | |
| 1066 | 1068 | { |
| 1067 | 1069 | socklen_t addrlen = tget32(target_addrlen); |
| 1068 | 1070 | void *addr = alloca(addrlen); |
| 1069 | - long ret; | |
| 1071 | + target_long ret; | |
| 1070 | 1072 | |
| 1071 | 1073 | ret = get_errno(getsockname(fd, addr, &addrlen)); |
| 1072 | 1074 | if (!is_error(ret)) { |
| ... | ... | @@ -1076,11 +1078,11 @@ static long do_getsockname(int fd, target_ulong target_addr, |
| 1076 | 1078 | return ret; |
| 1077 | 1079 | } |
| 1078 | 1080 | |
| 1079 | -static long do_socketpair(int domain, int type, int protocol, | |
| 1080 | - target_ulong target_tab) | |
| 1081 | +static target_long do_socketpair(int domain, int type, int protocol, | |
| 1082 | + target_ulong target_tab) | |
| 1081 | 1083 | { |
| 1082 | 1084 | int tab[2]; |
| 1083 | - long ret; | |
| 1085 | + target_long ret; | |
| 1084 | 1086 | |
| 1085 | 1087 | ret = get_errno(socketpair(domain, type, protocol, tab)); |
| 1086 | 1088 | if (!is_error(ret)) { |
| ... | ... | @@ -1090,12 +1092,12 @@ static long do_socketpair(int domain, int type, int protocol, |
| 1090 | 1092 | return ret; |
| 1091 | 1093 | } |
| 1092 | 1094 | |
| 1093 | -static long do_sendto(int fd, target_ulong msg, size_t len, int flags, | |
| 1094 | - target_ulong target_addr, socklen_t addrlen) | |
| 1095 | +static target_long do_sendto(int fd, target_ulong msg, size_t len, int flags, | |
| 1096 | + target_ulong target_addr, socklen_t addrlen) | |
| 1095 | 1097 | { |
| 1096 | 1098 | void *addr; |
| 1097 | 1099 | void *host_msg; |
| 1098 | - long ret; | |
| 1100 | + target_long ret; | |
| 1099 | 1101 | |
| 1100 | 1102 | host_msg = lock_user(msg, len, 1); |
| 1101 | 1103 | if (target_addr) { |
| ... | ... | @@ -1109,13 +1111,14 @@ static long do_sendto(int fd, target_ulong msg, size_t len, int flags, |
| 1109 | 1111 | return ret; |
| 1110 | 1112 | } |
| 1111 | 1113 | |
| 1112 | -static long do_recvfrom(int fd, target_ulong msg, size_t len, int flags, | |
| 1113 | - target_ulong target_addr, target_ulong target_addrlen) | |
| 1114 | +static target_long do_recvfrom(int fd, target_ulong msg, size_t len, int flags, | |
| 1115 | + target_ulong target_addr, | |
| 1116 | + target_ulong target_addrlen) | |
| 1114 | 1117 | { |
| 1115 | 1118 | socklen_t addrlen; |
| 1116 | 1119 | void *addr; |
| 1117 | 1120 | void *host_msg; |
| 1118 | - long ret; | |
| 1121 | + target_long ret; | |
| 1119 | 1122 | |
| 1120 | 1123 | host_msg = lock_user(msg, len, 0); |
| 1121 | 1124 | if (target_addr) { |
| ... | ... | @@ -1138,9 +1141,10 @@ static long do_recvfrom(int fd, target_ulong msg, size_t len, int flags, |
| 1138 | 1141 | return ret; |
| 1139 | 1142 | } |
| 1140 | 1143 | |
| 1141 | -static long do_socketcall(int num, target_ulong vptr) | |
| 1144 | +#ifdef TARGET_NR_socketcall | |
| 1145 | +static target_long do_socketcall(int num, target_ulong vptr) | |
| 1142 | 1146 | { |
| 1143 | - long ret; | |
| 1147 | + target_long ret; | |
| 1144 | 1148 | const int n = sizeof(target_ulong); |
| 1145 | 1149 | |
| 1146 | 1150 | switch(num) { |
| ... | ... | @@ -1300,7 +1304,9 @@ static long do_socketcall(int num, target_ulong vptr) |
| 1300 | 1304 | } |
| 1301 | 1305 | return ret; |
| 1302 | 1306 | } |
| 1307 | +#endif | |
| 1303 | 1308 | |
| 1309 | +#ifdef TARGET_NR_ipc | |
| 1304 | 1310 | #define N_SHM_REGIONS 32 |
| 1305 | 1311 | |
| 1306 | 1312 | static struct shm_region { |
| ... | ... | @@ -1407,7 +1413,7 @@ union target_semun { |
| 1407 | 1413 | unsigned short int *array; |
| 1408 | 1414 | }; |
| 1409 | 1415 | |
| 1410 | -static inline void target_to_host_semun(unsigned long cmd, | |
| 1416 | +static inline void target_to_host_semun(int cmd, | |
| 1411 | 1417 | union semun *host_su, |
| 1412 | 1418 | target_ulong target_addr, |
| 1413 | 1419 | struct semid_ds *ds) |
| ... | ... | @@ -1439,7 +1445,7 @@ static inline void target_to_host_semun(unsigned long cmd, |
| 1439 | 1445 | } |
| 1440 | 1446 | } |
| 1441 | 1447 | |
| 1442 | -static inline void host_to_target_semun(unsigned long cmd, | |
| 1448 | +static inline void host_to_target_semun(int cmd, | |
| 1443 | 1449 | target_ulong target_addr, |
| 1444 | 1450 | union semun *host_su, |
| 1445 | 1451 | struct semid_ds *ds) |
| ... | ... | @@ -1470,12 +1476,13 @@ static inline void host_to_target_semun(unsigned long cmd, |
| 1470 | 1476 | } |
| 1471 | 1477 | } |
| 1472 | 1478 | |
| 1473 | -static inline long do_semctl(long first, long second, long third, long ptr) | |
| 1479 | +static inline target_long do_semctl(int first, int second, int third, | |
| 1480 | + target_long ptr) | |
| 1474 | 1481 | { |
| 1475 | 1482 | union semun arg; |
| 1476 | 1483 | struct semid_ds dsarg; |
| 1477 | 1484 | int cmd = third&0xff; |
| 1478 | - long ret = 0; | |
| 1485 | + target_long ret = 0; | |
| 1479 | 1486 | |
| 1480 | 1487 | switch( cmd ) { |
| 1481 | 1488 | case GETVAL: |
| ... | ... | @@ -1534,7 +1541,7 @@ struct target_msqid_ds |
| 1534 | 1541 | }; |
| 1535 | 1542 | |
| 1536 | 1543 | static inline void target_to_host_msqid_ds(struct msqid_ds *host_md, |
| 1537 | - target_ulong target_addr) | |
| 1544 | + target_ulong target_addr) | |
| 1538 | 1545 | { |
| 1539 | 1546 | struct target_msqid_ds *target_md; |
| 1540 | 1547 | |
| ... | ... | @@ -1569,11 +1576,11 @@ static inline void host_to_target_msqid_ds(target_ulong target_addr, |
| 1569 | 1576 | unlock_user_struct(target_md, target_addr, 1); |
| 1570 | 1577 | } |
| 1571 | 1578 | |
| 1572 | -static inline long do_msgctl(long first, long second, long ptr) | |
| 1579 | +static inline target_long do_msgctl(int first, int second, target_long ptr) | |
| 1573 | 1580 | { |
| 1574 | 1581 | struct msqid_ds dsarg; |
| 1575 | 1582 | int cmd = second&0xff; |
| 1576 | - long ret = 0; | |
| 1583 | + target_long ret = 0; | |
| 1577 | 1584 | switch( cmd ) { |
| 1578 | 1585 | case IPC_STAT: |
| 1579 | 1586 | case IPC_SET: |
| ... | ... | @@ -1591,11 +1598,12 @@ struct target_msgbuf { |
| 1591 | 1598 | char mtext[1]; |
| 1592 | 1599 | }; |
| 1593 | 1600 | |
| 1594 | -static inline long do_msgsnd(long msqid, long msgp, long msgsz, long msgflg) | |
| 1601 | +static inline target_long do_msgsnd(int msqid, target_long msgp, | |
| 1602 | + unsigned int msgsz, int msgflg) | |
| 1595 | 1603 | { |
| 1596 | 1604 | struct target_msgbuf *target_mb; |
| 1597 | 1605 | struct msgbuf *host_mb; |
| 1598 | - long ret = 0; | |
| 1606 | + target_long ret = 0; | |
| 1599 | 1607 | |
| 1600 | 1608 | lock_user_struct(target_mb,msgp,0); |
| 1601 | 1609 | host_mb = malloc(msgsz+sizeof(long)); |
| ... | ... | @@ -1608,11 +1616,13 @@ static inline long do_msgsnd(long msqid, long msgp, long msgsz, long msgflg) |
| 1608 | 1616 | return ret; |
| 1609 | 1617 | } |
| 1610 | 1618 | |
| 1611 | -static inline long do_msgrcv(long msqid, long msgp, long msgsz, long msgtype, long msgflg) | |
| 1619 | +static inline target_long do_msgrcv(int msqid, target_long msgp, | |
| 1620 | + unsigned int msgsz, int msgtype, | |
| 1621 | + int msgflg) | |
| 1612 | 1622 | { |
| 1613 | 1623 | struct target_msgbuf *target_mb; |
| 1614 | 1624 | struct msgbuf *host_mb; |
| 1615 | - long ret = 0; | |
| 1625 | + target_long ret = 0; | |
| 1616 | 1626 | |
| 1617 | 1627 | lock_user_struct(target_mb, msgp, 0); |
| 1618 | 1628 | host_mb = malloc(msgsz+sizeof(long)); |
| ... | ... | @@ -1627,11 +1637,12 @@ static inline long do_msgrcv(long msqid, long msgp, long msgsz, long msgtype, lo |
| 1627 | 1637 | } |
| 1628 | 1638 | |
| 1629 | 1639 | /* ??? This only works with linear mappings. */ |
| 1630 | -static long do_ipc(long call, long first, long second, long third, | |
| 1631 | - long ptr, long fifth) | |
| 1640 | +static target_long do_ipc(unsigned int call, int first, | |
| 1641 | + int second, int third, | |
| 1642 | + target_long ptr, target_long fifth) | |
| 1632 | 1643 | { |
| 1633 | 1644 | int version; |
| 1634 | - long ret = 0; | |
| 1645 | + target_long ret = 0; | |
| 1635 | 1646 | unsigned long raddr; |
| 1636 | 1647 | struct shmid_ds shm_info; |
| 1637 | 1648 | int i; |
| ... | ... | @@ -1653,7 +1664,7 @@ static long do_ipc(long call, long first, long second, long third, |
| 1653 | 1664 | break; |
| 1654 | 1665 | |
| 1655 | 1666 | case IPCOP_semtimedop: |
| 1656 | - gemu_log("Unsupported ipc call: %ld (version %d)\n", call, version); | |
| 1667 | + gemu_log("Unsupported ipc call: %d (version %d)\n", call, version); | |
| 1657 | 1668 | ret = -ENOSYS; |
| 1658 | 1669 | break; |
| 1659 | 1670 | |
| ... | ... | @@ -1709,7 +1720,7 @@ static long do_ipc(long call, long first, long second, long third, |
| 1709 | 1720 | break; |
| 1710 | 1721 | } |
| 1711 | 1722 | } |
| 1712 | - if (put_user(raddr, (uint32_t *)third)) | |
| 1723 | + if (put_user(raddr, (target_ulong *)third)) | |
| 1713 | 1724 | return -EFAULT; |
| 1714 | 1725 | ret = 0; |
| 1715 | 1726 | break; |
| ... | ... | @@ -1743,12 +1754,13 @@ static long do_ipc(long call, long first, long second, long third, |
| 1743 | 1754 | break; |
| 1744 | 1755 | default: |
| 1745 | 1756 | unimplemented: |
| 1746 | - gemu_log("Unsupported ipc call: %ld (version %d)\n", call, version); | |
| 1757 | + gemu_log("Unsupported ipc call: %d (version %d)\n", call, version); | |
| 1747 | 1758 | ret = -ENOSYS; |
| 1748 | 1759 | break; |
| 1749 | 1760 | } |
| 1750 | 1761 | return ret; |
| 1751 | 1762 | } |
| 1763 | +#endif | |
| 1752 | 1764 | |
| 1753 | 1765 | /* kernel structure types definitions */ |
| 1754 | 1766 | #define IFNAMSIZ 16 |
| ... | ... | @@ -1789,11 +1801,11 @@ IOCTLEntry ioctl_entries[] = { |
| 1789 | 1801 | }; |
| 1790 | 1802 | |
| 1791 | 1803 | /* ??? Implement proper locking for ioctls. */ |
| 1792 | -static long do_ioctl(long fd, long cmd, long arg) | |
| 1804 | +static target_long do_ioctl(int fd, target_long cmd, target_long arg) | |
| 1793 | 1805 | { |
| 1794 | 1806 | const IOCTLEntry *ie; |
| 1795 | 1807 | const argtype *arg_type; |
| 1796 | - long ret; | |
| 1808 | + target_long ret; | |
| 1797 | 1809 | uint8_t buf_temp[MAX_STRUCT_SIZE]; |
| 1798 | 1810 | int target_size; |
| 1799 | 1811 | void *argptr; |
| ... | ... | @@ -1801,7 +1813,7 @@ static long do_ioctl(long fd, long cmd, long arg) |
| 1801 | 1813 | ie = ioctl_entries; |
| 1802 | 1814 | for(;;) { |
| 1803 | 1815 | if (ie->target_cmd == 0) { |
| 1804 | - gemu_log("Unsupported ioctl: cmd=0x%04lx\n", cmd); | |
| 1816 | + gemu_log("Unsupported ioctl: cmd=0x%04lx\n", (long)cmd); | |
| 1805 | 1817 | return -ENOSYS; |
| 1806 | 1818 | } |
| 1807 | 1819 | if (ie->target_cmd == cmd) |
| ... | ... | @@ -1810,7 +1822,7 @@ static long do_ioctl(long fd, long cmd, long arg) |
| 1810 | 1822 | } |
| 1811 | 1823 | arg_type = ie->arg_type; |
| 1812 | 1824 | #if defined(DEBUG) |
| 1813 | - gemu_log("ioctl: cmd=0x%04lx (%s)\n", cmd, ie->name); | |
| 1825 | + gemu_log("ioctl: cmd=0x%04lx (%s)\n", (long)cmd, ie->name); | |
| 1814 | 1826 | #endif |
| 1815 | 1827 | switch(arg_type[0]) { |
| 1816 | 1828 | case TYPE_NULL: |
| ... | ... | @@ -1855,7 +1867,8 @@ static long do_ioctl(long fd, long cmd, long arg) |
| 1855 | 1867 | } |
| 1856 | 1868 | break; |
| 1857 | 1869 | default: |
| 1858 | - gemu_log("Unsupported ioctl type: cmd=0x%04lx type=%d\n", cmd, arg_type[0]); | |
| 1870 | + gemu_log("Unsupported ioctl type: cmd=0x%04lx type=%d\n", | |
| 1871 | + (long)cmd, arg_type[0]); | |
| 1859 | 1872 | ret = -ENOSYS; |
| 1860 | 1873 | break; |
| 1861 | 1874 | } |
| ... | ... | @@ -2205,7 +2218,7 @@ static int clone_func(void *arg) |
| 2205 | 2218 | return 0; |
| 2206 | 2219 | } |
| 2207 | 2220 | |
| 2208 | -int do_fork(CPUState *env, unsigned int flags, unsigned long newsp) | |
| 2221 | +int do_fork(CPUState *env, unsigned int flags, target_ulong newsp) | |
| 2209 | 2222 | { |
| 2210 | 2223 | int ret; |
| 2211 | 2224 | TaskState *ts; |
| ... | ... | @@ -2291,13 +2304,13 @@ int do_fork(CPUState *env, unsigned int flags, unsigned long newsp) |
| 2291 | 2304 | return ret; |
| 2292 | 2305 | } |
| 2293 | 2306 | |
| 2294 | -static long do_fcntl(int fd, int cmd, target_ulong arg) | |
| 2307 | +static target_long do_fcntl(int fd, int cmd, target_ulong arg) | |
| 2295 | 2308 | { |
| 2296 | 2309 | struct flock fl; |
| 2297 | 2310 | struct target_flock *target_fl; |
| 2298 | 2311 | struct flock64 fl64; |
| 2299 | 2312 | struct target_flock64 *target_fl64; |
| 2300 | - long ret; | |
| 2313 | + target_long ret; | |
| 2301 | 2314 | |
| 2302 | 2315 | switch(cmd) { |
| 2303 | 2316 | case TARGET_F_GETLK: |
| ... | ... | @@ -2456,6 +2469,7 @@ void syscall_init(void) |
| 2456 | 2469 | } |
| 2457 | 2470 | } |
| 2458 | 2471 | |
| 2472 | +#if TARGET_LONG_BITS == 32 | |
| 2459 | 2473 | static inline uint64_t target_offset64(uint32_t word0, uint32_t word1) |
| 2460 | 2474 | { |
| 2461 | 2475 | #ifdef TARGET_WORDS_BIG_ENDIAN |
| ... | ... | @@ -2464,10 +2478,18 @@ static inline uint64_t target_offset64(uint32_t word0, uint32_t word1) |
| 2464 | 2478 | return ((uint64_t)word1 << 32) | word0; |
| 2465 | 2479 | #endif |
| 2466 | 2480 | } |
| 2481 | +#else /* TARGET_LONG_BITS == 32 */ | |
| 2482 | +static inline uint64_t target_offset64(uint64_t word0, uint64_t word1) | |
| 2483 | +{ | |
| 2484 | + return word0; | |
| 2485 | +} | |
| 2486 | +#endif /* TARGET_LONG_BITS != 32 */ | |
| 2467 | 2487 | |
| 2468 | 2488 | #ifdef TARGET_NR_truncate64 |
| 2469 | -static inline long target_truncate64(void *cpu_env, const char *arg1, | |
| 2470 | - long arg2, long arg3, long arg4) | |
| 2489 | +static inline target_long target_truncate64(void *cpu_env, const char *arg1, | |
| 2490 | + target_long arg2, | |
| 2491 | + target_long arg3, | |
| 2492 | + target_long arg4) | |
| 2471 | 2493 | { |
| 2472 | 2494 | #ifdef TARGET_ARM |
| 2473 | 2495 | if (((CPUARMState *)cpu_env)->eabi) |
| ... | ... | @@ -2481,8 +2503,10 @@ static inline long target_truncate64(void *cpu_env, const char *arg1, |
| 2481 | 2503 | #endif |
| 2482 | 2504 | |
| 2483 | 2505 | #ifdef TARGET_NR_ftruncate64 |
| 2484 | -static inline long target_ftruncate64(void *cpu_env, long arg1, long arg2, | |
| 2485 | - long arg3, long arg4) | |
| 2506 | +static inline target_long target_ftruncate64(void *cpu_env, target_long arg1, | |
| 2507 | + target_long arg2, | |
| 2508 | + target_long arg3, | |
| 2509 | + target_long arg4) | |
| 2486 | 2510 | { |
| 2487 | 2511 | #ifdef TARGET_ARM |
| 2488 | 2512 | if (((CPUARMState *)cpu_env)->eabi) |
| ... | ... | @@ -2517,10 +2541,11 @@ static inline void host_to_target_timespec(target_ulong target_addr, |
| 2517 | 2541 | unlock_user_struct(target_ts, target_addr, 1); |
| 2518 | 2542 | } |
| 2519 | 2543 | |
| 2520 | -long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, | |
| 2521 | - long arg4, long arg5, long arg6) | |
| 2544 | +target_long do_syscall(void *cpu_env, int num, target_long arg1, | |
| 2545 | + target_long arg2, target_long arg3, target_long arg4, | |
| 2546 | + target_long arg5, target_long arg6) | |
| 2522 | 2547 | { |
| 2523 | - long ret; | |
| 2548 | + target_long ret; | |
| 2524 | 2549 | struct stat st; |
| 2525 | 2550 | struct statfs stfs; |
| 2526 | 2551 | void *p; |
| ... | ... | @@ -4018,7 +4043,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
| 4018 | 4043 | { |
| 4019 | 4044 | struct target_dirent *target_dirp; |
| 4020 | 4045 | struct dirent *dirp; |
| 4021 | - long count = arg3; | |
| 4046 | + target_long count = arg3; | |
| 4022 | 4047 | |
| 4023 | 4048 | dirp = malloc(count); |
| 4024 | 4049 | if (!dirp) |
| ... | ... | @@ -4060,7 +4085,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
| 4060 | 4085 | #else |
| 4061 | 4086 | { |
| 4062 | 4087 | struct dirent *dirp; |
| 4063 | - long count = arg3; | |
| 4088 | + target_long count = arg3; | |
| 4064 | 4089 | |
| 4065 | 4090 | dirp = lock_user(arg2, count, 0); |
| 4066 | 4091 | ret = get_errno(sys_getdents(arg1, dirp, count)); |
| ... | ... | @@ -4088,7 +4113,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
| 4088 | 4113 | case TARGET_NR_getdents64: |
| 4089 | 4114 | { |
| 4090 | 4115 | struct dirent64 *dirp; |
| 4091 | - long count = arg3; | |
| 4116 | + target_long count = arg3; | |
| 4092 | 4117 | dirp = lock_user(arg2, count, 0); |
| 4093 | 4118 | ret = get_errno(sys_getdents64(arg1, dirp, count)); |
| 4094 | 4119 | if (!is_error(ret)) { |
| ... | ... | @@ -4941,4 +4966,3 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
| 4941 | 4966 | #endif |
| 4942 | 4967 | return ret; |
| 4943 | 4968 | } |
| 4944 | - | ... | ... |