From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Inbcu-0007yE-4J for qemu-devel@nongnu.org; Thu, 01 Nov 2007 11:06:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Inbct-0007x1-FW for qemu-devel@nongnu.org; Thu, 01 Nov 2007 11:06:31 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Inbct-0007vZ-8l for qemu-devel@nongnu.org; Thu, 01 Nov 2007 11:06:31 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Inbcr-0005nm-7q for qemu-devel@nongnu.org; Thu, 01 Nov 2007 11:06:29 -0400 Message-ID: <4729EB70.7010006@mail.berlios.de> Date: Thu, 01 Nov 2007 16:06:24 +0100 From: Stefan Weil MIME-Version: 1.0 Subject: Re: [Qemu-devel] [Patch] Fix compiler warnings References: <4701577A.8050509@mail.berlios.de> In-Reply-To: <4701577A.8050509@mail.berlios.de> Content-Type: multipart/mixed; boundary="------------010601080405010309030609" Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU Developers This is a multi-part message in MIME format. --------------010601080405010309030609 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit I send an update of the patch for current QEMU CVS HEAD in the hope that it will be integrated in CVS... Stefan Stefan Weil schrieb: > Hello, > > this patch fixes some compiler warnings in two QEMU source files: > > * missing include unistd.h for syscall > > * comparision of unsigned value with -1 > (mmap returns pointer with error value MAP_FAILED) > > I also replaced leading tabs in mmap.c by blanks. > > Please add this patch to CVS head. > > Regards > Stefan --------------010601080405010309030609 Content-Type: text/x-diff; name="qemu.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="qemu.patch" Index: linux-user/mmap.c =================================================================== RCS file: /sources/qemu/qemu/linux-user/mmap.c,v retrieving revision 1.17 diff -u -r1.17 mmap.c --- linux-user/mmap.c 14 Oct 2007 16:27:29 -0000 1.17 +++ linux-user/mmap.c 1 Nov 2007 10:22:57 -0000 @@ -37,7 +37,7 @@ #ifdef DEBUG_MMAP printf("mprotect: start=0x" TARGET_FMT_lx - "len=0x" TARGET_FMT_lx " prot=%c%c%c\n", start, len, + "len=0x" TARGET_FMT_lx " prot=%c%c%c\n", start, len, prot & PROT_READ ? 'r' : '-', prot & PROT_WRITE ? 'w' : '-', prot & PROT_EXEC ? 'x' : '-'); @@ -100,7 +100,7 @@ abi_ulong start, abi_ulong end, int prot, int flags, int fd, abi_ulong offset) { - abi_ulong real_end, ret, addr; + abi_ulong real_end, addr; void *host_start; int prot1, prot_new; @@ -116,10 +116,10 @@ if (prot1 == 0) { /* no page was there, so we allocate one */ - ret = (long)mmap(host_start, qemu_host_page_size, prot, - flags | MAP_ANONYMOUS, -1, 0); - if (ret == -1) - return ret; + void *p = mmap(host_start, qemu_host_page_size, prot, + flags | MAP_ANONYMOUS, -1, 0); + if (p == MAP_FAILED) + return -1; prot1 = prot; } prot1 &= PAGE_BITS; @@ -168,7 +168,7 @@ #ifdef DEBUG_MMAP { printf("mmap: start=0x" TARGET_FMT_lx - " len=0x" TARGET_FMT_lx " prot=%c%c%c flags=", + " len=0x" TARGET_FMT_lx " prot=%c%c%c flags=", start, len, prot & PROT_READ ? 'r' : '-', prot & PROT_WRITE ? 'w' : '-', @@ -230,16 +230,16 @@ */ abi_ulong host_end; unsigned long host_aligned_start; + void *p; host_len = HOST_PAGE_ALIGN(host_len + qemu_host_page_size - qemu_real_host_page_size); - host_start = (unsigned long) mmap(real_start ? - g2h(real_start) : NULL, - host_len, prot, flags, - fd, host_offset); - if (host_start == -1) + p = mmap(real_start ? g2h(real_start) : NULL, + host_len, prot, flags, fd, host_offset); + if (p == MAP_FAILED) return -1; + host_start = (unsigned long)p; host_end = host_start + host_len; /* Find start and end, aligned to the targets pagesize with-in the @@ -260,11 +260,12 @@ goto the_end1; } else { /* if not fixed, no need to do anything */ - host_start = (long)mmap(real_start ? g2h(real_start) : NULL, + void *p = mmap(real_start ? g2h(real_start) : NULL, host_len, prot, flags, fd, host_offset); - if (host_start == -1) + if (p == MAP_FAILED) return -1; /* update start so that it points to the file position at 'offset' */ + host_start = (unsigned long)p; if (!(flags & MAP_ANONYMOUS)) host_start += offset - host_offset; start = h2g(host_start); @@ -333,14 +334,15 @@ /* map the middle (easier) */ if (real_start < real_end) { + void *p; unsigned long offset1; - if (flags & MAP_ANONYMOUS) - offset1 = 0; - else - offset1 = offset + real_start - start; - ret = (long)mmap(g2h(real_start), real_end - real_start, - prot, flags, fd, offset1); - if (ret == -1) + if (flags & MAP_ANONYMOUS) + offset1 = 0; + else + offset1 = offset + real_start - start; + p = mmap(g2h(real_start), real_end - real_start, + prot, flags, fd, offset1); + if (p == MAP_FAILED) return -1; } the_end1: Index: target-i386/helper2.c =================================================================== RCS file: /sources/qemu/qemu/target-i386/helper2.c,v retrieving revision 1.53 diff -u -r1.53 helper2.c --- target-i386/helper2.c 14 Oct 2007 07:07:06 -0000 1.53 +++ target-i386/helper2.c 1 Nov 2007 10:22:58 -0000 @@ -32,6 +32,7 @@ //#define DEBUG_MMU #ifdef USE_CODE_COPY +#include #include #include #include --------------010601080405010309030609--