diff options
author | Juergen Lock <nox@jelal.kn-bremen.de> | 2010-03-25 22:11:17 +0100 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2010-03-30 17:44:51 +0000 |
commit | b035ffd11813524d7c0e44354f5c4bdd281f4b37 (patch) | |
tree | 3e030559fb464aec7b38acb39195e9f7c07731bd /bsd-user/mmap.c | |
parent | d1839d7367303e38e603bc0371d65648b4480078 (diff) |
Fix bsd-user qemu_vmalloc() host page protection code
Just do the same as linux-user does.
Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'bsd-user/mmap.c')
-rw-r--r-- | bsd-user/mmap.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 139cd3f442..207c774fb0 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -77,16 +77,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_ANON, -1, 0); - addr = (unsigned long)p; - if (addr == (target_ulong) addr) { + if (h2g_valid(p)) { /* Allocated region overlaps guest address space. This may recurse. */ + abi_ulong addr = h2g(p); page_set_flags(addr & TARGET_PAGE_MASK, TARGET_PAGE_ALIGN(addr + size), PAGE_RESERVED); } |