[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/4] 64-bit clean socketcall syscall
From: |
Ulrich Hecht |
Subject: |
[Qemu-devel] [PATCH 2/4] 64-bit clean socketcall syscall |
Date: |
Fri, 3 Jul 2009 17:09:28 +0200 |
makes socketcall 64-bit clean so it works on 64-bit big-endian systems
Signed-off-by: Ulrich Hecht <address@hidden>
---
linux-user/syscall.c | 130 +++++++++++++++++++++++++-------------------------
1 files changed, 65 insertions(+), 65 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 57bb9a7..e541b0d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1751,11 +1751,11 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
switch(num) {
case SOCKOP_socket:
{
- int domain, type, protocol;
+ abi_ulong domain, type, protocol;
- if (get_user_s32(domain, vptr)
- || get_user_s32(type, vptr + n)
- || get_user_s32(protocol, vptr + 2 * n))
+ if (get_user_ual(domain, vptr)
+ || get_user_ual(type, vptr + n)
+ || get_user_ual(protocol, vptr + 2 * n))
return -TARGET_EFAULT;
ret = do_socket(domain, type, protocol);
@@ -1763,13 +1763,13 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
break;
case SOCKOP_bind:
{
- int sockfd;
+ abi_ulong sockfd;
abi_ulong target_addr;
socklen_t addrlen;
- if (get_user_s32(sockfd, vptr)
+ if (get_user_ual(sockfd, vptr)
|| get_user_ual(target_addr, vptr + n)
- || get_user_u32(addrlen, vptr + 2 * n))
+ || get_user_ual(addrlen, vptr + 2 * n))
return -TARGET_EFAULT;
ret = do_bind(sockfd, target_addr, addrlen);
@@ -1777,13 +1777,13 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
break;
case SOCKOP_connect:
{
- int sockfd;
+ abi_ulong sockfd;
abi_ulong target_addr;
socklen_t addrlen;
- if (get_user_s32(sockfd, vptr)
+ if (get_user_ual(sockfd, vptr)
|| get_user_ual(target_addr, vptr + n)
- || get_user_u32(addrlen, vptr + 2 * n))
+ || get_user_ual(addrlen, vptr + 2 * n))
return -TARGET_EFAULT;
ret = do_connect(sockfd, target_addr, addrlen);
@@ -1791,10 +1791,10 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
break;
case SOCKOP_listen:
{
- int sockfd, backlog;
+ abi_ulong sockfd, backlog;
- if (get_user_s32(sockfd, vptr)
- || get_user_s32(backlog, vptr + n))
+ if (get_user_ual(sockfd, vptr)
+ || get_user_ual(backlog, vptr + n))
return -TARGET_EFAULT;
ret = get_errno(listen(sockfd, backlog));
@@ -1802,12 +1802,12 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
break;
case SOCKOP_accept:
{
- int sockfd;
+ abi_ulong sockfd;
abi_ulong target_addr, target_addrlen;
- if (get_user_s32(sockfd, vptr)
+ if (get_user_ual(sockfd, vptr)
|| get_user_ual(target_addr, vptr + n)
- || get_user_u32(target_addrlen, vptr + 2 * n))
+ || get_user_ual(target_addrlen, vptr + 2 * n))
return -TARGET_EFAULT;
ret = do_accept(sockfd, target_addr, target_addrlen);
@@ -1815,12 +1815,12 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
break;
case SOCKOP_getsockname:
{
- int sockfd;
+ abi_ulong sockfd;
abi_ulong target_addr, target_addrlen;
- if (get_user_s32(sockfd, vptr)
+ if (get_user_ual(sockfd, vptr)
|| get_user_ual(target_addr, vptr + n)
- || get_user_u32(target_addrlen, vptr + 2 * n))
+ || get_user_ual(target_addrlen, vptr + 2 * n))
return -TARGET_EFAULT;
ret = do_getsockname(sockfd, target_addr, target_addrlen);
@@ -1828,12 +1828,12 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
break;
case SOCKOP_getpeername:
{
- int sockfd;
+ abi_ulong sockfd;
abi_ulong target_addr, target_addrlen;
- if (get_user_s32(sockfd, vptr)
+ if (get_user_ual(sockfd, vptr)
|| get_user_ual(target_addr, vptr + n)
- || get_user_u32(target_addrlen, vptr + 2 * n))
+ || get_user_ual(target_addrlen, vptr + 2 * n))
return -TARGET_EFAULT;
ret = do_getpeername(sockfd, target_addr, target_addrlen);
@@ -1841,12 +1841,12 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
break;
case SOCKOP_socketpair:
{
- int domain, type, protocol;
+ abi_ulong domain, type, protocol;
abi_ulong tab;
- if (get_user_s32(domain, vptr)
- || get_user_s32(type, vptr + n)
- || get_user_s32(protocol, vptr + 2 * n)
+ if (get_user_ual(domain, vptr)
+ || get_user_ual(type, vptr + n)
+ || get_user_ual(protocol, vptr + 2 * n)
|| get_user_ual(tab, vptr + 3 * n))
return -TARGET_EFAULT;
@@ -1855,15 +1855,15 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
break;
case SOCKOP_send:
{
- int sockfd;
+ abi_ulong sockfd;
abi_ulong msg;
size_t len;
- int flags;
+ abi_ulong flags;
- if (get_user_s32(sockfd, vptr)
+ if (get_user_ual(sockfd, vptr)
|| get_user_ual(msg, vptr + n)
|| get_user_ual(len, vptr + 2 * n)
- || get_user_s32(flags, vptr + 3 * n))
+ || get_user_ual(flags, vptr + 3 * n))
return -TARGET_EFAULT;
ret = do_sendto(sockfd, msg, len, flags, 0, 0);
@@ -1871,15 +1871,15 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
break;
case SOCKOP_recv:
{
- int sockfd;
+ abi_ulong sockfd;
abi_ulong msg;
size_t len;
- int flags;
+ abi_ulong flags;
- if (get_user_s32(sockfd, vptr)
+ if (get_user_ual(sockfd, vptr)
|| get_user_ual(msg, vptr + n)
|| get_user_ual(len, vptr + 2 * n)
- || get_user_s32(flags, vptr + 3 * n))
+ || get_user_ual(flags, vptr + 3 * n))
return -TARGET_EFAULT;
ret = do_recvfrom(sockfd, msg, len, flags, 0, 0);
@@ -1887,19 +1887,19 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
break;
case SOCKOP_sendto:
{
- int sockfd;
+ abi_ulong sockfd;
abi_ulong msg;
size_t len;
- int flags;
+ abi_ulong flags;
abi_ulong addr;
socklen_t addrlen;
- if (get_user_s32(sockfd, vptr)
+ if (get_user_ual(sockfd, vptr)
|| get_user_ual(msg, vptr + n)
|| get_user_ual(len, vptr + 2 * n)
- || get_user_s32(flags, vptr + 3 * n)
+ || get_user_ual(flags, vptr + 3 * n)
|| get_user_ual(addr, vptr + 4 * n)
- || get_user_u32(addrlen, vptr + 5 * n))
+ || get_user_ual(addrlen, vptr + 5 * n))
return -TARGET_EFAULT;
ret = do_sendto(sockfd, msg, len, flags, addr, addrlen);
@@ -1907,19 +1907,19 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
break;
case SOCKOP_recvfrom:
{
- int sockfd;
+ abi_ulong sockfd;
abi_ulong msg;
size_t len;
- int flags;
+ abi_ulong flags;
abi_ulong addr;
socklen_t addrlen;
- if (get_user_s32(sockfd, vptr)
+ if (get_user_ual(sockfd, vptr)
|| get_user_ual(msg, vptr + n)
|| get_user_ual(len, vptr + 2 * n)
- || get_user_s32(flags, vptr + 3 * n)
+ || get_user_ual(flags, vptr + 3 * n)
|| get_user_ual(addr, vptr + 4 * n)
- || get_user_u32(addrlen, vptr + 5 * n))
+ || get_user_ual(addrlen, vptr + 5 * n))
return -TARGET_EFAULT;
ret = do_recvfrom(sockfd, msg, len, flags, addr, addrlen);
@@ -1927,10 +1927,10 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
break;
case SOCKOP_shutdown:
{
- int sockfd, how;
+ abi_ulong sockfd, how;
- if (get_user_s32(sockfd, vptr)
- || get_user_s32(how, vptr + n))
+ if (get_user_ual(sockfd, vptr)
+ || get_user_ual(how, vptr + n))
return -TARGET_EFAULT;
ret = get_errno(shutdown(sockfd, how));
@@ -1939,13 +1939,13 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
case SOCKOP_sendmsg:
case SOCKOP_recvmsg:
{
- int fd;
+ abi_ulong fd;
abi_ulong target_msg;
- int flags;
+ abi_ulong flags;
- if (get_user_s32(fd, vptr)
+ if (get_user_ual(fd, vptr)
|| get_user_ual(target_msg, vptr + n)
- || get_user_s32(flags, vptr + 2 * n))
+ || get_user_ual(flags, vptr + 2 * n))
return -TARGET_EFAULT;
ret = do_sendrecvmsg(fd, target_msg, flags,
@@ -1954,17 +1954,17 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
break;
case SOCKOP_setsockopt:
{
- int sockfd;
- int level;
- int optname;
+ abi_ulong sockfd;
+ abi_ulong level;
+ abi_ulong optname;
abi_ulong optval;
socklen_t optlen;
- if (get_user_s32(sockfd, vptr)
- || get_user_s32(level, vptr + n)
- || get_user_s32(optname, vptr + 2 * n)
+ if (get_user_ual(sockfd, vptr)
+ || get_user_ual(level, vptr + n)
+ || get_user_ual(optname, vptr + 2 * n)
|| get_user_ual(optval, vptr + 3 * n)
- || get_user_u32(optlen, vptr + 4 * n))
+ || get_user_ual(optlen, vptr + 4 * n))
return -TARGET_EFAULT;
ret = do_setsockopt(sockfd, level, optname, optval, optlen);
@@ -1972,17 +1972,17 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
break;
case SOCKOP_getsockopt:
{
- int sockfd;
- int level;
- int optname;
+ abi_ulong sockfd;
+ abi_ulong level;
+ abi_ulong optname;
abi_ulong optval;
socklen_t optlen;
- if (get_user_s32(sockfd, vptr)
- || get_user_s32(level, vptr + n)
- || get_user_s32(optname, vptr + 2 * n)
+ if (get_user_ual(sockfd, vptr)
+ || get_user_ual(level, vptr + n)
+ || get_user_ual(optname, vptr + 2 * n)
|| get_user_ual(optval, vptr + 3 * n)
- || get_user_u32(optlen, vptr + 4 * n))
+ || get_user_ual(optlen, vptr + 4 * n))
return -TARGET_EFAULT;
ret = do_getsockopt(sockfd, level, optname, optval, optlen);
--
1.6.2.1