diff options
author | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-12-12 01:16:23 +0000 |
---|---|---|
committer | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-12-12 01:16:23 +0000 |
commit | 50a9569b591a83071052614f2ff497ff2f2aa2ef (patch) | |
tree | 30d4e9bcc715acfaa72cb0b949d256103f83b3d0 /exec.c | |
parent | 703243a044c8b7d5c52fdf67e4c1aacf1d6c4d76 (diff) |
Mark host pages as reserved (Magnus Damm).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3813 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'exec.c')
-rw-r--r-- | exec.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -209,6 +209,27 @@ static void page_init(void) qemu_host_page_mask = ~(qemu_host_page_size - 1); l1_phys_map = qemu_vmalloc(L1_SIZE * sizeof(void *)); memset(l1_phys_map, 0, L1_SIZE * sizeof(void *)); + +#if !defined(_WIN32) && defined(CONFIG_USER_ONLY) + { + long long startaddr, endaddr; + FILE *f; + int n; + + f = fopen("/proc/self/maps", "r"); + if (f) { + do { + n = fscanf (f, "%llx-%llx %*[^\n]\n", &startaddr, &endaddr); + if (n == 2) { + page_set_flags(TARGET_PAGE_ALIGN(startaddr), + TARGET_PAGE_ALIGN(endaddr), + PAGE_RESERVED); + } + } while (!feof(f)); + fclose(f); + } + } +#endif } static inline PageDesc *page_find_alloc(unsigned int index) |