提交 7bc7b099 编写于 作者: R Richard Henderson 提交者: Paul Brook

linux-user: Use h2g_valid in qemu_vmalloc.

Signed-off-by: NRichard Henderson <rth@twiddle.net>
上级 b9f83121
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册