summaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2010-05-05 16:32:59 +0100
committerPaul Brook <paul@codesourcery.com>2010-05-05 16:32:59 +0100
commit2e9a5713f0567fffaa3518f495b8d16a2b74f84a (patch)
treee7c2651dc7f83db54d27af18a7f8fac7bf848437 /exec.c
parent048d179f20c1499c7f55957df125392de664b6a7 (diff)
downloadqemu-2e9a5713f0567fffaa3518f495b8d16a2b74f84a.tar.gz
qemu-2e9a5713f0567fffaa3518f495b8d16a2b74f84a.tar.bz2
qemu-2e9a5713f0567fffaa3518f495b8d16a2b74f84a.zip
Remove PAGE_RESERVED
The usermode PAGE_RESERVED code is not required by the current mmap implementation, and is already broken when guest_base != 0. Unfortunately the bsd emulation still uses the old mmap implementation, so we can't rip it out altogether. Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c31
1 files changed, 2 insertions, 29 deletions
diff --git a/exec.c b/exec.c
index 14d1fd733d..95b92f7f63 100644
--- a/exec.c
+++ b/exec.c
@@ -288,7 +288,7 @@ static void page_init(void)
qemu_host_page_bits++;
qemu_host_page_mask = ~(qemu_host_page_size - 1);
-#if !defined(_WIN32) && defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_BSD) && defined(CONFIG_USER_ONLY)
{
#ifdef HAVE_KINFO_GETVMMAP
struct kinfo_vmentry *freep;
@@ -324,11 +324,7 @@ static void page_init(void)
last_brk = (unsigned long)sbrk(0);
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
f = fopen("/compat/linux/proc/self/maps", "r");
-#else
- f = fopen("/proc/self/maps", "r");
-#endif
if (f) {
mmap_lock();
@@ -365,24 +361,11 @@ static PageDesc *page_find_alloc(tb_page_addr_t index, int alloc)
int i;
#if defined(CONFIG_USER_ONLY)
- /* We can't use qemu_malloc because it may recurse into a locked mutex.
- Neither can we record the new pages we reserve while allocating a
- given page because that may recurse into an unallocated page table
- entry. Stuff the allocations we do make into a queue and process
- them after having completed one entire page table allocation. */
-
- unsigned long reserve[2 * (V_L1_SHIFT / L2_BITS)];
- int reserve_idx = 0;
-
+ /* We can't use qemu_malloc because it may recurse into a locked mutex. */
# define ALLOC(P, SIZE) \
do { \
P = mmap(NULL, SIZE, PROT_READ | PROT_WRITE, \
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \
- if (h2g_valid(P)) { \
- reserve[reserve_idx] = h2g(P); \
- reserve[reserve_idx + 1] = SIZE; \
- reserve_idx += 2; \
- } \
} while (0)
#else
# define ALLOC(P, SIZE) \
@@ -417,16 +400,6 @@ static PageDesc *page_find_alloc(tb_page_addr_t index, int alloc)
}
#undef ALLOC
-#if defined(CONFIG_USER_ONLY)
- for (i = 0; i < reserve_idx; i += 2) {
- unsigned long addr = reserve[i];
- unsigned long len = reserve[i + 1];
-
- page_set_flags(addr & TARGET_PAGE_MASK,
- TARGET_PAGE_ALIGN(addr + len),
- PAGE_RESERVED);
- }
-#endif
return pd + (index & (L2_SIZE - 1));
}