aboutsummaryrefslogtreecommitdiff
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2007-10-14 16:27:31 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2007-10-14 16:27:31 +0000
commit992f48a036cccf7101e31bf3e5d901ce5320e886 (patch)
tree5b7931bab0c9d92c266f87c0457b864cdd8b256b /linux-user/syscall.c
parentb227a8e9aa5f27d29f77ba90d5eb9d0662a1175e (diff)
Support for 32 bit ABI on 64 bit targets (only enabled Sparc64)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3396 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c400
1 files changed, 200 insertions, 200 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index a1d9ee1e5c..e4ea31349c 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -368,7 +368,7 @@ static inline int host_to_target_errno(int err)
return err;
}
-static inline target_long get_errno(target_long ret)
+static inline abi_long get_errno(abi_long ret)
{
if (ret == -1)
return -host_to_target_errno(errno);
@@ -376,23 +376,23 @@ static inline target_long get_errno(target_long ret)
return ret;
}
-static inline int is_error(target_long ret)
+static inline int is_error(abi_long ret)
{
- return (target_ulong)ret >= (target_ulong)(-4096);
+ return (abi_ulong)ret >= (abi_ulong)(-4096);
}
-static target_ulong target_brk;
-static target_ulong target_original_brk;
+static abi_ulong target_brk;
+static abi_ulong target_original_brk;
-void target_set_brk(target_ulong new_brk)
+void target_set_brk(abi_ulong new_brk)
{
target_original_brk = target_brk = HOST_PAGE_ALIGN(new_brk);
}
-target_long do_brk(target_ulong new_brk)
+abi_long do_brk(abi_ulong new_brk)
{
- target_ulong brk_page;
- target_long mapped_addr;
+ abi_ulong brk_page;
+ abi_long mapped_addr;
int new_alloc_size;
if (!new_brk)
@@ -422,7 +422,7 @@ target_long do_brk(target_ulong new_brk)
}
static inline fd_set *target_to_host_fds(fd_set *fds,
- target_long *target_fds, int n)
+ abi_long *target_fds, int n)
{
#if !defined(BSWAP_NEEDED) && !defined(WORDS_BIGENDIAN)
return (fd_set *)target_fds;
@@ -431,8 +431,8 @@ static inline fd_set *target_to_host_fds(fd_set *fds,
if (target_fds) {
FD_ZERO(fds);
for(i = 0;i < n; i++) {
- b = (tswapl(target_fds[i / TARGET_LONG_BITS]) >>
- (i & (TARGET_LONG_BITS - 1))) & 1;
+ b = (tswapl(target_fds[i / TARGET_ABI_BITS]) >>
+ (i & (TARGET_ABI_BITS - 1))) & 1;
if (b)
FD_SET(i, fds);
}
@@ -443,21 +443,21 @@ static inline fd_set *target_to_host_fds(fd_set *fds,
#endif
}
-static inline void host_to_target_fds(target_long *target_fds,
+static inline void host_to_target_fds(abi_long *target_fds,
fd_set *fds, int n)
{
#if !defined(BSWAP_NEEDED) && !defined(WORDS_BIGENDIAN)
/* nothing to do */
#else
int i, nw, j, k;
- target_long v;
+ abi_long v;
if (target_fds) {
- nw = (n + TARGET_LONG_BITS - 1) / TARGET_LONG_BITS;
+ nw = (n + TARGET_ABI_BITS - 1) / TARGET_ABI_BITS;
k = 0;
for(i = 0;i < nw; i++) {
v = 0;
- for(j = 0; j < TARGET_LONG_BITS; j++) {
+ for(j = 0; j < TARGET_ABI_BITS; j++) {
v |= ((FD_ISSET(k, fds) != 0) << j);
k++;
}
@@ -473,7 +473,7 @@ static inline void host_to_target_fds(target_long *target_fds,
#define HOST_HZ 100
#endif
-static inline target_long host_to_target_clock_t(long ticks)
+static inline abi_long host_to_target_clock_t(long ticks)
{
#if HOST_HZ == TARGET_HZ
return ticks;
@@ -482,7 +482,7 @@ static inline target_long host_to_target_clock_t(long ticks)
#endif
}
-static inline void host_to_target_rusage(target_ulong target_addr,
+static inline void host_to_target_rusage(abi_ulong target_addr,
const struct rusage *rusage)
{
struct target_rusage *target_rusage;
@@ -510,7 +510,7 @@ static inline void host_to_target_rusage(target_ulong target_addr,
}
static inline void target_to_host_timeval(struct timeval *tv,
- target_ulong target_addr)
+ abi_ulong target_addr)
{
struct target_timeval *target_tv;
@@ -520,7 +520,7 @@ static inline void target_to_host_timeval(struct timeval *tv,
unlock_user_struct(target_tv, target_addr, 0);
}
-static inline void host_to_target_timeval(target_ulong target_addr,
+static inline void host_to_target_timeval(abi_ulong target_addr,
const struct timeval *tv)
{
struct target_timeval *target_tv;
@@ -532,33 +532,33 @@ static inline void host_to_target_timeval(target_ulong target_addr,
}
-static target_long do_select(int n,
- target_ulong rfd_p, target_ulong wfd_p,
- target_ulong efd_p, target_ulong target_tv)
+static abi_long do_select(int n,
+ abi_ulong rfd_p, abi_ulong wfd_p,
+ abi_ulong efd_p, abi_ulong target_tv)
{
fd_set rfds, wfds, efds;
fd_set *rfds_ptr, *wfds_ptr, *efds_ptr;
- target_long *target_rfds, *target_wfds, *target_efds;
+ abi_long *target_rfds, *target_wfds, *target_efds;
struct timeval tv, *tv_ptr;
- target_long ret;
+ abi_long ret;
int ok;
if (rfd_p) {
- target_rfds = lock_user(rfd_p, sizeof(target_long) * n, 1);
+ target_rfds = lock_user(rfd_p, sizeof(abi_long) * n, 1);
rfds_ptr = target_to_host_fds(&rfds, target_rfds, n);
} else {
target_rfds = NULL;
rfds_ptr = NULL;
}
if (wfd_p) {
- target_wfds = lock_user(wfd_p, sizeof(target_long) * n, 1);
+ target_wfds = lock_user(wfd_p, sizeof(abi_long) * n, 1);
wfds_ptr = target_to_host_fds(&wfds, target_wfds, n);
} else {
target_wfds = NULL;
wfds_ptr = NULL;
}
if (efd_p) {
- target_efds = lock_user(efd_p, sizeof(target_long) * n, 1);
+ target_efds = lock_user(efd_p, sizeof(abi_long) * n, 1);
efds_ptr = target_to_host_fds(&efds, target_efds, n);
} else {
target_efds = NULL;
@@ -584,17 +584,17 @@ static target_long do_select(int n,
}
}
if (target_rfds)
- unlock_user(target_rfds, rfd_p, ok ? sizeof(target_long) * n : 0);
+ unlock_user(target_rfds, rfd_p, ok ? sizeof(abi_long) * n : 0);
if (target_wfds)
- unlock_user(target_wfds, wfd_p, ok ? sizeof(target_long) * n : 0);
+ unlock_user(target_wfds, wfd_p, ok ? sizeof(abi_long) * n : 0);
if (target_efds)
- unlock_user(target_efds, efd_p, ok ? sizeof(target_long) * n : 0);
+ unlock_user(target_efds, efd_p, ok ? sizeof(abi_long) * n : 0);
return ret;
}
static inline void target_to_host_sockaddr(struct sockaddr *addr,
- target_ulong target_addr,
+ abi_ulong target_addr,
socklen_t len)
{
struct target_sockaddr *target_saddr;
@@ -605,7 +605,7 @@ static inline void target_to_host_sockaddr(struct sockaddr *addr,
unlock_user(target_saddr, target_addr, 0);
}
-static inline void host_to_target_sockaddr(target_ulong target_addr,
+static inline void host_to_target_sockaddr(abi_ulong target_addr,
struct sockaddr *addr,
socklen_t len)
{
@@ -706,10 +706,10 @@ static inline void host_to_target_cmsg(struct target_msghdr *target_msgh,
msgh->msg_controllen = tswapl(space);
}
-static target_long do_setsockopt(int sockfd, int level, int optname,
- target_ulong optval, socklen_t optlen)
+static abi_long do_setsockopt(int sockfd, int level, int optname,
+ abi_ulong optval, socklen_t optlen)
{
- target_long ret;
+ abi_long ret;
int val;
switch(level) {
@@ -827,10 +827,10 @@ static target_long do_setsockopt(int sockfd, int level, int optname,
return ret;
}
-static target_long do_getsockopt(int sockfd, int level, int optname,
- target_ulong optval, target_ulong optlen)
+static abi_long do_getsockopt(int sockfd, int level, int optname,
+ abi_ulong optval, abi_ulong optlen)
{
- target_long ret;
+ abi_long ret;
int len, lv, val;
switch(level) {
@@ -916,11 +916,11 @@ static target_long do_getsockopt(int sockfd, int level, int optname,
return ret;
}
-static void lock_iovec(struct iovec *vec, target_ulong target_addr,
+static void lock_iovec(struct iovec *vec, abi_ulong target_addr,
int count, int copy)
{
struct target_iovec *target_vec;
- target_ulong base;
+ abi_ulong base;
int i;
target_vec = lock_user(target_addr, count * sizeof(struct target_iovec), 1);
@@ -932,11 +932,11 @@ static void lock_iovec(struct iovec *vec, target_ulong target_addr,
unlock_user (target_vec, target_addr, 0);
}
-static void unlock_iovec(struct iovec *vec, target_ulong target_addr,
+static void unlock_iovec(struct iovec *vec, abi_ulong target_addr,
int count, int copy)
{
struct target_iovec *target_vec;
- target_ulong base;
+ abi_ulong base;
int i;
target_vec = lock_user(target_addr, count * sizeof(struct target_iovec), 1);
@@ -947,7 +947,7 @@ static void unlock_iovec(struct iovec *vec, target_ulong target_addr,
unlock_user (target_vec, target_addr, 0);
}
-static target_long do_socket(int domain, int type, int protocol)
+static abi_long do_socket(int domain, int type, int protocol)
{
#if defined(TARGET_MIPS)
switch(type) {
@@ -974,8 +974,8 @@ static target_long do_socket(int domain, int type, int protocol)
return get_errno(socket(domain, type, protocol));
}
-static target_long do_bind(int sockfd, target_ulong target_addr,
- socklen_t addrlen)
+static abi_long do_bind(int sockfd, abi_ulong target_addr,
+ socklen_t addrlen)
{
void *addr = alloca(addrlen);
@@ -983,8 +983,8 @@ static target_long do_bind(int sockfd, target_ulong target_addr,
return get_errno(bind(sockfd, addr, addrlen));
}
-static target_long do_connect(int sockfd, target_ulong target_addr,
- socklen_t addrlen)
+static abi_long do_connect(int sockfd, abi_ulong target_addr,
+ socklen_t addrlen)
{
void *addr = alloca(addrlen);
@@ -992,15 +992,15 @@ static target_long do_connect(int sockfd, target_ulong target_addr,
return get_errno(connect(sockfd, addr, addrlen));
}
-static target_long do_sendrecvmsg(int fd, target_ulong target_msg,
- int flags, int send)
+static abi_long do_sendrecvmsg(int fd, abi_ulong target_msg,
+ int flags, int send)
{
- target_long ret;
+ abi_long ret;
struct target_msghdr *msgp;
struct msghdr msg;
int count;
struct iovec *vec;
- target_ulong target_vec;
+ abi_ulong target_vec;
lock_user_struct(msgp, target_msg, 1);
if (msgp->msg_name) {
@@ -1035,12 +1035,12 @@ static target_long do_sendrecvmsg(int fd, target_ulong target_msg,
return ret;
}
-static target_long do_accept(int fd, target_ulong target_addr,
- target_ulong target_addrlen)
+static abi_long do_accept(int fd, abi_ulong target_addr,
+ abi_ulong target_addrlen)
{
socklen_t addrlen = tget32(target_addrlen);
void *addr = alloca(addrlen);
- target_long ret;
+ abi_long ret;
ret = get_errno(accept(fd, addr, &addrlen));
if (!is_error(ret)) {
@@ -1050,12 +1050,12 @@ static target_long do_accept(int fd, target_ulong target_addr,
return ret;
}
-static target_long do_getpeername(int fd, target_ulong target_addr,
- target_ulong target_addrlen)
+static abi_long do_getpeername(int fd, abi_ulong target_addr,
+ abi_ulong target_addrlen)
{
socklen_t addrlen = tget32(target_addrlen);
void *addr = alloca(addrlen);
- target_long ret;
+ abi_long ret;
ret = get_errno(getpeername(fd, addr, &addrlen));
if (!is_error(ret)) {
@@ -1065,12 +1065,12 @@ static target_long do_getpeername(int fd, target_ulong target_addr,
return ret;
}
-static target_long do_getsockname(int fd, target_ulong target_addr,
- target_ulong target_addrlen)
+static abi_long do_getsockname(int fd, abi_ulong target_addr,
+ abi_ulong target_addrlen)
{
socklen_t addrlen = tget32(target_addrlen);
void *addr = alloca(addrlen);
- target_long ret;
+ abi_long ret;
ret = get_errno(getsockname(fd, addr, &addrlen));
if (!is_error(ret)) {
@@ -1080,11 +1080,11 @@ static target_long do_getsockname(int fd, target_ulong target_addr,
return ret;
}
-static target_long do_socketpair(int domain, int type, int protocol,
- target_ulong target_tab)
+static abi_long do_socketpair(int domain, int type, int protocol,
+ abi_ulong target_tab)
{
int tab[2];
- target_long ret;
+ abi_long ret;
ret = get_errno(socketpair(domain, type, protocol, tab));
if (!is_error(ret)) {
@@ -1094,12 +1094,12 @@ static target_long do_socketpair(int domain, int type, int protocol,
return ret;
}
-static target_long do_sendto(int fd, target_ulong msg, size_t len, int flags,
- target_ulong target_addr, socklen_t addrlen)
+static abi_long do_sendto(int fd, abi_ulong msg, size_t len, int flags,
+ abi_ulong target_addr, socklen_t addrlen)
{
void *addr;
void *host_msg;
- target_long ret;
+ abi_long ret;
host_msg = lock_user(msg, len, 1);
if (target_addr) {
@@ -1113,14 +1113,14 @@ static target_long do_sendto(int fd, target_ulong msg, size_t len, int flags,
return ret;
}
-static target_long do_recvfrom(int fd, target_ulong msg, size_t len, int flags,
- target_ulong target_addr,
- target_ulong target_addrlen)
+static abi_long do_recvfrom(int fd, abi_ulong msg, size_t len, int flags,
+ abi_ulong target_addr,
+ abi_ulong target_addrlen)
{
socklen_t addrlen;
void *addr;
void *host_msg;
- target_long ret;
+ abi_long ret;
host_msg = lock_user(msg, len, 0);
if (target_addr) {
@@ -1144,10 +1144,10 @@ static target_long do_recvfrom(int fd, target_ulong msg, size_t len, int flags,
}
#ifdef TARGET_NR_socketcall
-static target_long do_socketcall(int num, target_ulong vptr)
+static abi_long do_socketcall(int num, abi_ulong vptr)
{
- target_long ret;
- const int n = sizeof(target_ulong);
+ abi_long ret;
+ const int n = sizeof(abi_ulong);
switch(num) {
case SOCKOP_socket:
@@ -1161,7 +1161,7 @@ static target_long do_socketcall(int num, target_ulong vptr)
case SOCKOP_bind:
{
int sockfd = tgetl(vptr);
- target_ulong target_addr = tgetl(vptr + n);
+ abi_ulong target_addr = tgetl(vptr + n);
socklen_t addrlen = tgetl(vptr + 2 * n);
ret = do_bind(sockfd, target_addr, addrlen);
}
@@ -1169,7 +1169,7 @@ static target_long do_socketcall(int num, target_ulong vptr)
case SOCKOP_connect:
{
int sockfd = tgetl(vptr);
- target_ulong target_addr = tgetl(vptr + n);
+ abi_ulong target_addr = tgetl(vptr + n);
socklen_t addrlen = tgetl(vptr + 2 * n);
ret = do_connect(sockfd, target_addr, addrlen);
}
@@ -1184,24 +1184,24 @@ static target_long do_socketcall(int num, target_ulong vptr)
case SOCKOP_accept:
{
int sockfd = tgetl(vptr);
- target_ulong target_addr = tgetl(vptr + n);
- target_ulong target_addrlen = tgetl(vptr + 2 * n);
+ abi_ulong target_addr = tgetl(vptr + n);
+ abi_ulong target_addrlen = tgetl(vptr + 2 * n);
ret = do_accept(sockfd, target_addr, target_addrlen);
}
break;
case SOCKOP_getsockname:
{
int sockfd = tgetl(vptr);
- target_ulong target_addr = tgetl(vptr + n);
- target_ulong target_addrlen = tgetl(vptr + 2 * n);
+ abi_ulong target_addr = tgetl(vptr + n);
+ abi_ulong target_addrlen = tgetl(vptr + 2 * n);
ret = do_getsockname(sockfd, target_addr, target_addrlen);
}
break;
case SOCKOP_getpeername:
{
int sockfd = tgetl(vptr);
- target_ulong target_addr = tgetl(vptr + n);
- target_ulong target_addrlen = tgetl(vptr + 2 * n);
+ abi_ulong target_addr = tgetl(vptr + n);
+ abi_ulong target_addrlen = tgetl(vptr + 2 * n);
ret = do_getpeername(sockfd, target_addr, target_addrlen);
}
break;
@@ -1210,14 +1210,14 @@ static target_long do_socketcall(int num, target_ulong vptr)
int domain = tgetl(vptr);
int type = tgetl(vptr + n);
int protocol = tgetl(vptr + 2 * n);
- target_ulong tab = tgetl(vptr + 3 * n);
+ abi_ulong tab = tgetl(vptr + 3 * n);
ret = do_socketpair(domain, type, protocol, tab);
}
break;
case SOCKOP_send:
{
int sockfd = tgetl(vptr);
- target_ulong msg = tgetl(vptr + n);
+ abi_ulong msg = tgetl(vptr + n);
size_t len = tgetl(vptr + 2 * n);
int flags = tgetl(vptr + 3 * n);
ret = do_sendto(sockfd, msg, len, flags, 0, 0);
@@ -1226,7 +1226,7 @@ static target_long do_socketcall(int num, target_ulong vptr)
case SOCKOP_recv:
{
int sockfd = tgetl(vptr);
- target_ulong msg = tgetl(vptr + n);
+ abi_ulong msg = tgetl(vptr + n);
size_t len = tgetl(vptr + 2 * n);
int flags = tgetl(vptr + 3 * n);
ret = do_recvfrom(sockfd, msg, len, flags, 0, 0);
@@ -1235,10 +1235,10 @@ static target_long do_socketcall(int num, target_ulong vptr)
case SOCKOP_sendto:
{
int sockfd = tgetl(vptr);
- target_ulong msg = tgetl(vptr + n);
+ abi_ulong msg = tgetl(vptr + n);
size_t len = tgetl(vptr + 2 * n);
int flags = tgetl(vptr + 3 * n);
- target_ulong addr = tgetl(vptr + 4 * n);
+ abi_ulong addr = tgetl(vptr + 4 * n);
socklen_t addrlen = tgetl(vptr + 5 * n);
ret = do_sendto(sockfd, msg, len, flags, addr, addrlen);
}
@@ -1246,11 +1246,11 @@ static target_long do_socketcall(int num, target_ulong vptr)
case SOCKOP_recvfrom:
{
int sockfd = tgetl(vptr);
- target_ulong msg = tgetl(vptr + n);
+ abi_ulong msg = tgetl(vptr + n);
size_t len = tgetl(vptr + 2 * n);
int flags = tgetl(vptr + 3 * n);
- target_ulong addr = tgetl(vptr + 4 * n);
- target_ulong addrlen = tgetl(vptr + 5 * n);
+ abi_ulong addr = tgetl(vptr + 4 * n);
+ abi_ulong addrlen = tgetl(vptr + 5 * n);
ret = do_recvfrom(sockfd, msg, len, flags, addr, addrlen);
}
break;
@@ -1266,7 +1266,7 @@ static target_long do_socketcall(int num, target_ulong vptr)
case SOCKOP_recvmsg:
{
int fd;
- target_ulong target_msg;
+ abi_ulong target_msg;
int flags;
fd = tgetl(vptr);
@@ -1282,7 +1282,7 @@ static target_long do_socketcall(int num, target_ulong vptr)
int sockfd = tgetl(vptr);
int level = tgetl(vptr + n);
int optname = tgetl(vptr + 2 * n);
- target_ulong optval = tgetl(vptr + 3 * n);
+ abi_ulong optval = tgetl(vptr + 3 * n);
socklen_t optlen = tgetl(vptr + 4 * n);
ret = do_setsockopt(sockfd, level, optname, optval, optlen);
@@ -1293,8 +1293,8 @@ static target_long do_socketcall(int num, target_ulong vptr)
int sockfd = tgetl(vptr);
int level = tgetl(vptr + n);
int optname = tgetl(vptr + 2 * n);
- target_ulong optval = tgetl(vptr + 3 * n);
- target_ulong poptlen = tgetl(vptr + 4 * n);
+ abi_ulong optval = tgetl(vptr + 3 * n);
+ abi_ulong poptlen = tgetl(vptr + 4 * n);
ret = do_getsockopt(sockfd, level, optname, optval, poptlen);
}
@@ -1318,33 +1318,33 @@ static struct shm_region {
struct target_ipc_perm
{
- target_long __key;
- target_ulong uid;
- target_ulong gid;
- target_ulong cuid;
- target_ulong cgid;
+ abi_long __key;
+ abi_ulong uid;
+ abi_ulong gid;
+ abi_ulong cuid;
+ abi_ulong cgid;
unsigned short int mode;
unsigned short int __pad1;
unsigned short int __seq;
unsigned short int __pad2;
- target_ulong __unused1;
- target_ulong __unused2;
+ abi_ulong __unused1;
+ abi_ulong __unused2;
};
struct target_semid_ds
{
struct target_ipc_perm sem_perm;
- target_ulong sem_otime;
- target_ulong __unused1;
- target_ulong sem_ctime;
- target_ulong __unused2;
- target_ulong sem_nsems;
- target_ulong __unused3;
- target_ulong __unused4;
+ abi_ulong sem_otime;
+ abi_ulong __unused1;
+ abi_ulong sem_ctime;
+ abi_ulong __unused2;
+ abi_ulong sem_nsems;
+ abi_ulong __unused3;
+ abi_ulong __unused4;
};
static inline void target_to_host_ipc_perm(struct ipc_perm *host_ip,
- target_ulong target_addr)
+ abi_ulong target_addr)
{
struct target_ipc_perm *target_ip;
struct target_semid_ds *target_sd;
@@ -1360,7 +1360,7 @@ static inline void target_to_host_ipc_perm(struct ipc_perm *host_ip,
unlock_user_struct(target_sd, target_addr, 0);
}
-static inline void host_to_target_ipc_perm(target_ulong target_addr,
+static inline void host_to_target_ipc_perm(abi_ulong target_addr,
struct ipc_perm *host_ip)
{
struct target_ipc_perm *target_ip;
@@ -1378,7 +1378,7 @@ static inline void host_to_target_ipc_perm(target_ulong target_addr,
}
static inline void target_to_host_semid_ds(struct semid_ds *host_sd,
- target_ulong target_addr)
+ abi_ulong target_addr)
{
struct target_semid_ds *target_sd;
@@ -1390,7 +1390,7 @@ static inline void target_to_host_semid_ds(struct semid_ds *host_sd,
unlock_user_struct(target_sd, target_addr, 0);
}
-static inline void host_to_target_semid_ds(target_ulong target_addr,
+static inline void host_to_target_semid_ds(abi_ulong target_addr,
struct semid_ds *host_sd)
{
struct target_semid_ds *target_sd;
@@ -1411,13 +1411,13 @@ union semun {
union target_semun {
int val;
- target_long buf;
+ abi_long buf;
unsigned short int *array;
};
static inline void target_to_host_semun(int cmd,
union semun *host_su,
- target_ulong target_addr,
+ abi_ulong target_addr,
struct semid_ds *ds)
{
union target_semun *target_su;
@@ -1448,7 +1448,7 @@ static inline void target_to_host_semun(int cmd,
}
static inline void host_to_target_semun(int cmd,
- target_ulong target_addr,
+ abi_ulong target_addr,
union semun *host_su,
struct semid_ds *ds)
{
@@ -1478,13 +1478,13 @@ static inline void host_to_target_semun(int cmd,
}
}
-static inline target_long do_semctl(int first, int second, int third,
- target_long ptr)
+static inline abi_long do_semctl(int first, int second, int third,
+ abi_long ptr)
{
union semun arg;
struct semid_ds dsarg;
int cmd = third&0xff;
- target_long ret = 0;
+ abi_long ret = 0;
switch( cmd ) {
case GETVAL:
@@ -1527,23 +1527,23 @@ static inline target_long do_semctl(int first, int second, int third,
struct target_msqid_ds
{
struct target_ipc_perm msg_perm;
- target_ulong msg_stime;
- target_ulong __unused1;
- target_ulong msg_rtime;
- target_ulong __unused2;
- target_ulong msg_ctime;
- target_ulong __unused3;
- target_ulong __msg_cbytes;
- target_ulong msg_qnum;
- target_ulong msg_qbytes;
- target_ulong msg_lspid;
- target_ulong msg_lrpid;
- target_ulong __unused4;
- target_ulong __unused5;
+ abi_ulong msg_stime;
+ abi_ulong __unused1;
+ abi_ulong msg_rtime;
+ abi_ulong __unused2;
+ abi_ulong msg_ctime;
+ abi_ulong __unused3;
+ abi_ulong __msg_cbytes;
+ abi_ulong msg_qnum;
+ abi_ulong msg_qbytes;
+ abi_ulong msg_lspid;
+ abi_ulong msg_lrpid;
+ abi_ulong __unused4;
+ abi_ulong __unused5;
};
static inline void target_to_host_msqid_ds(struct msqid_ds *host_md,
- target_ulong target_addr)
+ abi_ulong target_addr)
{
struct target_msqid_ds *target_md;
@@ -1560,7 +1560,7 @@ static inline void target_to_host_msqid_ds(struct msqid_ds *host_md,
unlock_user_struct(target_md, target_addr, 0);
}
-static inline void host_to_target_msqid_ds(target_ulong target_addr,
+static inline void host_to_target_msqid_ds(abi_ulong target_addr,
struct msqid_ds *host_md)
{
struct target_msqid_ds *target_md;
@@ -1578,11 +1578,11 @@ static inline void host_to_target_msqid_ds(target_ulong target_addr,
unlock_user_struct(target_md, target_addr, 1);
}
-static inline target_long do_msgctl(int first, int second, target_long ptr)
+static inline abi_long do_msgctl(int first, int second, abi_long ptr)
{
struct msqid_ds dsarg;
int cmd = second&0xff;
- target_long ret = 0;
+ abi_long ret = 0;
switch( cmd ) {
case IPC_STAT:
case IPC_SET:
@@ -1596,16 +1596,16 @@ static inline target_long do_msgctl(int first, int second, target_long ptr)
}
struct target_msgbuf {
- target_ulong mtype;
+ abi_ulong mtype;
char mtext[1];
};
-static inline target_long do_msgsnd(int msqid, target_long msgp,
- unsigned int msgsz, int msgflg)
+static inline abi_long do_msgsnd(int msqid, abi_long msgp,
+ unsigned int msgsz, int msgflg)
{
struct target_msgbuf *target_mb;
struct msgbuf *host_mb;
- target_long ret = 0;
+ abi_long ret = 0;
lock_user_struct(target_mb,msgp,0);
host_mb = malloc(msgsz+sizeof(long));
@@ -1618,13 +1618,13 @@ static inline target_long do_msgsnd(int msqid, target_long msgp,
return ret;
}
-static inline target_long do_msgrcv(int msqid, target_long msgp,
- unsigned int msgsz, int msgtype,
- int msgflg)
+static inline abi_long do_msgrcv(int msqid, abi_long msgp,
+ unsigned int msgsz, int msgtype,
+ int msgflg)
{
struct target_msgbuf *target_mb;
struct msgbuf *host_mb;
- target_long ret = 0;
+ abi_long ret = 0;
lock_user_struct(target_mb, msgp, 0);
host_mb = malloc(msgsz+sizeof(long));
@@ -1639,12 +1639,12 @@ static inline target_long do_msgrcv(int msqid, target_long msgp,
}
/* ??? This only works with linear mappings. */
-static target_long do_ipc(unsigned int call, int first,
- int second, int third,
- target_long ptr, target_long fifth)
+static abi_long do_ipc(unsigned int call, int first,
+ int second, int third,
+ abi_long ptr, abi_long fifth)
{
int version;
- target_long ret = 0;
+ abi_long ret = 0;
unsigned long raddr;
struct shmid_ds shm_info;
int i;
@@ -1722,7 +1722,7 @@ static target_long do_ipc(unsigned int call, int first,
break;
}
}
- if (put_user(raddr, (target_ulong *)third))
+ if (put_user(raddr, (abi_ulong *)third))
return -EFAULT;
ret = 0;
break;
@@ -1803,11 +1803,11 @@ IOCTLEntry ioctl_entries[] = {
};
/* ??? Implement proper locking for ioctls. */
-static target_long do_ioctl(int fd, target_long cmd, target_long arg)
+static abi_long do_ioctl(int fd, abi_long cmd, abi_long arg)
{
const IOCTLEntry *ie;
const argtype *arg_type;
- target_long ret;
+ abi_long ret;
uint8_t buf_temp[MAX_STRUCT_SIZE];
int target_size;
void *argptr;
@@ -2088,7 +2088,7 @@ static bitmask_transtbl fcntl_flags_tbl[] = {
/* NOTE: there is really one LDT for all the threads */
uint8_t *ldt_table;
-static int read_ldt(target_ulong ptr, unsigned long bytecount)
+static int read_ldt(abi_ulong ptr, unsigned long bytecount)
{
int size;
void *p;
@@ -2107,7 +2107,7 @@ static int read_ldt(target_ulong ptr, unsigned long bytecount)
/* XXX: add locking support */
static int write_ldt(CPUX86State *env,
- target_ulong ptr, unsigned long bytecount, int oldmode)
+ abi_ulong ptr, unsigned long bytecount, int oldmode)
{
struct target_modify_ldt_ldt_s ldt_info;
struct target_modify_ldt_ldt_s *target_ldt_info;
@@ -2188,7 +2188,7 @@ install:
}
/* specific and weird i386 syscalls */
-int do_modify_ldt(CPUX86State *env, int func, target_ulong ptr, unsigned long bytecount)
+int do_modify_ldt(CPUX86State *env, int func, abi_ulong ptr, unsigned long bytecount)
{
int ret = -ENOSYS;
@@ -2220,7 +2220,7 @@ static int clone_func(void *arg)
return 0;
}
-int do_fork(CPUState *env, unsigned int flags, target_ulong newsp)
+int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp)
{
int ret;
TaskState *ts;
@@ -2310,13 +2310,13 @@ int do_fork(CPUState *env, unsigned int flags, target_ulong newsp)
return ret;
}
-static target_long do_fcntl(int fd, int cmd, target_ulong arg)
+static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
{
struct flock fl;
struct target_flock *target_fl;
struct flock64 fl64;
struct target_flock64 *target_fl64;
- target_long ret;
+ abi_long ret;
switch(cmd) {
case TARGET_F_GETLK:
@@ -2475,7 +2475,7 @@ void syscall_init(void)
}
}
-#if TARGET_LONG_BITS == 32
+#if TARGET_ABI_BITS == 32
static inline uint64_t target_offset64(uint32_t word0, uint32_t word1)
{
#ifdef TARGET_WORDS_BIG_ENDIAN
@@ -2484,18 +2484,18 @@ static inline uint64_t target_offset64(uint32_t word0, uint32_t word1)
return ((uint64_t)word1 << 32) | word0;
#endif
}
-#else /* TARGET_LONG_BITS == 32 */
+#else /* TARGET_ABI_BITS == 32 */
static inline uint64_t target_offset64(uint64_t word0, uint64_t word1)
{
return word0;
}
-#endif /* TARGET_LONG_BITS != 32 */
+#endif /* TARGET_ABI_BITS != 32 */
#ifdef TARGET_NR_truncate64
-static inline target_long target_truncate64(void *cpu_env, const char *arg1,
- target_long arg2,
- target_long arg3,
- target_long arg4)
+static inline abi_long target_truncate64(void *cpu_env, const char *arg1,
+ abi_long arg2,
+ abi_long arg3,
+ abi_long arg4)
{
#ifdef TARGET_ARM
if (((CPUARMState *)cpu_env)->eabi)
@@ -2509,10 +2509,10 @@ static inline target_long target_truncate64(void *cpu_env, const char *arg1,
#endif
#ifdef TARGET_NR_ftruncate64
-static inline target_long target_ftruncate64(void *cpu_env, target_long arg1,
- target_long arg2,
- target_long arg3,
- target_long arg4)
+static inline abi_long target_ftruncate64(void *cpu_env, abi_long arg1,
+ abi_long arg2,
+ abi_long arg3,
+ abi_long arg4)
{
#ifdef TARGET_ARM
if (((CPUARMState *)cpu_env)->eabi)
@@ -2526,7 +2526,7 @@ static inline target_long target_ftruncate64(void *cpu_env, target_long arg1,
#endif
static inline void target_to_host_timespec(struct timespec *host_ts,
- target_ulong target_addr)
+ abi_ulong target_addr)
{
struct target_timespec *target_ts;
@@ -2536,7 +2536,7 @@ static inline void target_to_host_timespec(struct timespec *host_ts,
unlock_user_struct(target_ts, target_addr, 0);
}
-static inline void host_to_target_timespec(target_ulong target_addr,
+static inline void host_to_target_timespec(abi_ulong target_addr,
struct timespec *host_ts)
{
struct target_timespec *target_ts;
@@ -2547,11 +2547,11 @@ static inline void host_to_target_timespec(target_ulong target_addr,
unlock_user_struct(target_ts, target_addr, 1);
}
-target_long do_syscall(void *cpu_env, int num, target_long arg1,
- target_long arg2, target_long arg3, target_long arg4,
- target_long arg5, target_long arg6)
+abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
+ abi_long arg2, abi_long arg3, abi_long arg4,
+ abi_long arg5, abi_long arg6)
{
- target_long ret;
+ abi_long ret;
struct stat st;
struct statfs stfs;
void *p;
@@ -2687,10 +2687,10 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1,
{
char **argp, **envp;
int argc, envc;
- target_ulong gp;
- target_ulong guest_argp;
- target_ulong guest_envp;
- target_ulong addr;
+ abi_ulong gp;
+ abi_ulong guest_argp;
+ abi_ulong guest_envp;
+ abi_ulong addr;
char **q;
argc = 0;
@@ -2706,7 +2706,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1,
envp = alloca((envc + 1) * sizeof(void *));
for (gp = guest_argp, q = argp; ;
- gp += sizeof(target_ulong), q++) {
+ gp += sizeof(abi_ulong), q++) {
addr = tgetl(gp);
if (!addr)
break;
@@ -2715,7 +2715,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1,
*q = NULL;
for (gp = guest_envp, q = envp; ;
- gp += sizeof(target_ulong), q++) {
+ gp += sizeof(abi_ulong), q++) {
addr = tgetl(gp);
if (!addr)
break;
@@ -2728,12 +2728,12 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1,
unlock_user(p, arg1, 0);
for (gp = guest_argp, q = argp; *q;
- gp += sizeof(target_ulong), q++) {
+ gp += sizeof(abi_ulong), q++) {
addr = tgetl(gp);
unlock_user(*q, addr, 0);
}
for (gp = guest_envp, q = envp; *q;
- gp += sizeof(target_ulong), q++) {
+ gp += sizeof(abi_ulong), q++) {
addr = tgetl(gp);
unlock_user(*q, addr, 0);
}
@@ -3163,7 +3163,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1,
case TARGET_NR_sgetmask:
{
sigset_t cur_set;
- target_ulong target_set;
+ abi_ulong target_set;
sigprocmask(0, NULL, &cur_set);
host_to_target_old_sigset(&target_set, &cur_set);
ret = target_set;
@@ -3174,7 +3174,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1,
case TARGET_NR_ssetmask:
{
sigset_t set, oset, cur_set;
- target_ulong target_set = arg1;
+ abi_ulong target_set = arg1;
sigprocmask(0, NULL, &cur_set);
target_to_host_old_sigset(&set, &target_set);
sigorset(&set, &set, &cur_set);
@@ -3407,7 +3407,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1,
case TARGET_NR_select:
{
struct target_sel_arg_struct *sel;
- target_ulong inp, outp, exp, tvp;
+ abi_ulong inp, outp, exp, tvp;
long nsel;
lock_user_struct(sel, arg1, 1);
@@ -3510,9 +3510,9 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1,
case TARGET_NR_mmap:
#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_CRIS)
{
- target_ulong *v;
- target_ulong v1, v2, v3, v4, v5, v6;
- v = lock_user(arg1, 6 * sizeof(target_ulong), 1);
+ abi_ulong *v;
+ abi_ulong v1, v2, v3, v4, v5, v6;
+ v = lock_user(arg1, 6 * sizeof(abi_ulong), 1);
v1 = tswapl(v[0]);
v2 = tswapl(v[1]);
v3 = tswapl(v[2]);
@@ -3829,7 +3829,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1,
struct target_stat *target_st;
lock_user_struct(target_st, arg2, 0);
-#if defined(TARGET_MIPS) || defined(TARGET_SPARC64)
+#if defined(TARGET_MIPS) || (defined(TARGET_SPARC64) && !defined(TARGET_ABI32))
target_st->st_dev = tswap32(st.st_dev);
#else
target_st->st_dev = tswap16(st.st_dev);
@@ -3839,7 +3839,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1,
target_st->st_mode = tswapl(st.st_mode); /* XXX: check this */
target_st->st_uid = tswap32(st.st_uid);
target_st->st_gid = tswap32(st.st_gid);
-#elif defined(TARGET_SPARC64)
+#elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
target_st->st_mode = tswap32(st.st_mode);
target_st->st_uid = tswap32(st.st_uid);
target_st->st_gid = tswap32(st.st_gid);
@@ -3852,7 +3852,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1,
/* If this is the same on PPC, then just merge w/ the above ifdef */
target_st->st_nlink = tswapl(st.st_nlink);
target_st->st_rdev = tswapl(st.st_rdev);
-#elif defined(TARGET_SPARC64)
+#elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
target_st->st_nlink = tswap32(st.st_nlink);
target_st->st_rdev = tswap32(st.st_rdev);
#else
@@ -3892,9 +3892,9 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1,
case TARGET_NR_wait4:
{
int status;
- target_long status_ptr = arg2;
+ abi_long status_ptr = arg2;
struct rusage rusage, *rusage_ptr;
- target_ulong target_rusage = arg4;
+ abi_ulong target_rusage = arg4;
if (target_rusage)
rusage_ptr = &rusage;
else
@@ -4045,14 +4045,14 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1,
break;
#endif
case TARGET_NR_getdents:
-#if TARGET_LONG_SIZE != 4
+#if TARGET_ABI_BITS != 32
goto unimplemented;
#warning not supported
-#elif TARGET_LONG_SIZE == 4 && HOST_LONG_SIZE == 8
+#elif TARGET_ABI_BITS == 32 && HOST_LONG_BITS == 64
{
struct target_dirent *target_dirp;
struct dirent *dirp;
- target_long count = arg3;
+ abi_long count = arg3;
dirp = malloc(count);
if (!dirp)
@@ -4072,11 +4072,11 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1,
tde = target_dirp;
while (len > 0) {
reclen = de->d_reclen;
- treclen = reclen - (2 * (sizeof(long) - sizeof(target_long)));
+ treclen = reclen - (2 * (sizeof(long) - sizeof(abi_long)));
tde->d_reclen = tswap16(treclen);
tde->d_ino = tswapl(de->d_ino);
tde->d_off = tswapl(de->d_off);
- tnamelen = treclen - (2 * sizeof(target_long) + 2);
+ tnamelen = treclen - (2 * sizeof(abi_long) + 2);
if (tnamelen > 256)
tnamelen = 256;
/* XXX: may not be correct */
@@ -4094,7 +4094,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1,
#else
{
struct dirent *dirp;
- target_long count = arg3;
+ abi_long count = arg3;
dirp = lock_user(arg2, count, 0);
ret = get_errno(sys_getdents(arg1, dirp, count));
@@ -4122,7 +4122,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1,
case TARGET_NR_getdents64:
{
struct dirent64 *dirp;
- target_long count = arg3;
+ abi_long count = arg3;
dirp = lock_user(arg2, count, 0);
ret = get_errno(sys_getdents64(arg1, dirp, count));
if (!is_error(ret)) {
@@ -4742,7 +4742,7 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1,
ret = get_errno(0);
break;
#endif
-#if TARGET_LONG_BITS == 32
+#if TARGET_ABI_BITS == 32
case TARGET_NR_fcntl64:
{
int cmd;