]> Git Repo - qemu.git/commitdiff
linux-user: Use h2g_valid in qemu_vmalloc.
authorRichard Henderson <[email protected]>
Wed, 10 Mar 2010 22:38:59 +0000 (14:38 -0800)
committerPaul Brook <[email protected]>
Fri, 12 Mar 2010 16:29:07 +0000 (16:29 +0000)
Signed-off-by: Richard Henderson <[email protected]>
linux-user/mmap.c

index 25fc0b2959ef28a2b5b701e04c9849d4732fb34b..65fdc33c260c662bc8fe95c0beea48a72a235da6 100644 (file)
@@ -80,16 +80,15 @@ void mmap_unlock(void)
 void *qemu_vmalloc(size_t size)
 {
     void *p;
-    unsigned long addr;
+
     mmap_lock();
     /* Use map and mark the pages as used.  */
     p = mmap(NULL, size, PROT_READ | PROT_WRITE,
              MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 
-    addr = (unsigned long)p;
-    if (addr == (target_ulong) addr) {
-        /* Allocated region overlaps guest address space.
-           This may recurse.  */
+    if (h2g_valid(p)) {
+        /* Allocated region overlaps guest address space. This may recurse.  */
+        unsigned long addr = h2g(p);
         page_set_flags(addr & TARGET_PAGE_MASK, TARGET_PAGE_ALIGN(addr + size),
                        PAGE_RESERVED);
     }
This page took 0.028258 seconds and 4 git commands to generate.