qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [6056] Fix mremap, based on patch by Kirill A.
@ 2008-12-15 17:58 Blue Swirl
  0 siblings, 0 replies; only message in thread
From: Blue Swirl @ 2008-12-15 17:58 UTC (permalink / raw)
  To: qemu-devel

Revision: 6056
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6056
Author:   blueswir1
Date:     2008-12-15 17:58:49 +0000 (Mon, 15 Dec 2008)

Log Message:
-----------
Fix mremap, based on patch by Kirill A. Shutemov

Modified Paths:
--------------
    trunk/linux-user/mmap.c

Modified: trunk/linux-user/mmap.c
===================================================================
--- trunk/linux-user/mmap.c	2008-12-15 17:14:58 UTC (rev 6055)
+++ trunk/linux-user/mmap.c	2008-12-15 17:58:49 UTC (rev 6056)
@@ -24,6 +24,8 @@
 #include <unistd.h>
 #include <errno.h>
 #include <sys/mman.h>
+#include <linux/mman.h>
+#include <linux/unistd.h>
 
 #include "qemu.h"
 #include "qemu-common.h"
@@ -546,10 +548,11 @@
 
     mmap_lock();
 
-#if defined(MREMAP_FIXED)
     if (flags & MREMAP_FIXED)
-        host_addr = mremap(g2h(old_addr), old_size, new_size,
-                           flags, new_addr);
+        host_addr = (void *) syscall(__NR_mremap, g2h(old_addr),
+                                     old_size, new_size,
+                                     flags,
+                                     new_addr);
     else if (flags & MREMAP_MAYMOVE) {
         abi_ulong mmap_start;
 
@@ -559,11 +562,11 @@
             errno = ENOMEM;
             host_addr = MAP_FAILED;
         } else
-            host_addr = mremap(g2h(old_addr), old_size, new_size,
-                               flags | MREMAP_FIXED, g2h(mmap_start));
-    } else
-#endif
-    {
+            host_addr = (void *) syscall(__NR_mremap, g2h(old_addr),
+                                         old_size, new_size,
+                                         flags | MREMAP_FIXED,
+                                         g2h(mmap_start));
+    } else {
         host_addr = mremap(g2h(old_addr), old_size, new_size, flags);
         /* Check if address fits target address space */
         if ((unsigned long)host_addr + new_size > (abi_ulong)-1) {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-12-15 17:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-15 17:58 [Qemu-devel] [6056] Fix mremap, based on patch by Kirill A Blue Swirl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).