Revision b035ffd1 bsd-user/mmap.c
b/bsd-user/mmap.c | ||
---|---|---|
77 | 77 |
void *qemu_vmalloc(size_t size) |
78 | 78 |
{ |
79 | 79 |
void *p; |
80 |
unsigned long addr; |
|
81 | 80 |
mmap_lock(); |
82 | 81 |
/* Use map and mark the pages as used. */ |
83 | 82 |
p = mmap(NULL, size, PROT_READ | PROT_WRITE, |
84 | 83 |
MAP_PRIVATE | MAP_ANON, -1, 0); |
85 | 84 |
|
86 |
addr = (unsigned long)p; |
|
87 |
if (addr == (target_ulong) addr) { |
|
85 |
if (h2g_valid(p)) { |
|
88 | 86 |
/* Allocated region overlaps guest address space. |
89 | 87 |
This may recurse. */ |
88 |
abi_ulong addr = h2g(p); |
|
90 | 89 |
page_set_flags(addr & TARGET_PAGE_MASK, TARGET_PAGE_ALIGN(addr + size), |
91 | 90 |
PAGE_RESERVED); |
92 | 91 |
} |
Also available in: Unified diff