Revision 7bc7b099

b/linux-user/mmap.c
80 80
void *qemu_vmalloc(size_t size)
81 81
{
82 82
    void *p;
83
    unsigned long addr;
83

  
84 84
    mmap_lock();
85 85
    /* Use map and mark the pages as used.  */
86 86
    p = mmap(NULL, size, PROT_READ | PROT_WRITE,
87 87
             MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
88 88

  
89
    addr = (unsigned long)p;
90
    if (addr == (target_ulong) addr) {
91
        /* Allocated region overlaps guest address space.
92
           This may recurse.  */
89
    if (h2g_valid(p)) {
90
        /* Allocated region overlaps guest address space. This may recurse.  */
91
        unsigned long addr = h2g(p);
93 92
        page_set_flags(addr & TARGET_PAGE_MASK, TARGET_PAGE_ALIGN(addr + size),
94 93
                       PAGE_RESERVED);
95 94
    }

Also available in: Unified diff