Skip to content
Snippets Groups Projects
Commit b035ffd1 authored by Juergen Lock's avatar Juergen Lock Committed by Blue Swirl
Browse files

Fix bsd-user qemu_vmalloc() host page protection code


Just do the same as linux-user does.

Signed-off-by: default avatarJuergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: default avatarBlue Swirl <blauwirbel@gmail.com>
parent d1839d73
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment