From: Keir Fraser Date: Mon, 9 Mar 2009 08:43:11 +0000 (+0000) Subject: minios: Fix 18874 memory clipping X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ff117d3efe8e093a16babb67d69c8d6958809048;p=people%2Fliuw%2Flibxenctrl-split%2Fmini-os.git minios: Fix 18874 memory clipping Fix 18874's memory clipping: there are three page-sized holes between direct mapping, demand mapping, heap pages and the end of memory. Signed-off-by: Samuel Thibault --- diff --git a/arch/x86/mm.c b/arch/x86/mm.c index 6a2cb35..fd7af71 100644 --- a/arch/x86/mm.c +++ b/arch/x86/mm.c @@ -778,8 +778,7 @@ void arch_init_p2m(unsigned long max_pfn) void arch_init_mm(unsigned long* start_pfn_p, unsigned long* max_pfn_p) { - - unsigned long start_pfn, max_pfn, virt_pfns; + unsigned long start_pfn, max_pfn; printk(" _text: %p(VA)\n", &_text); printk(" _etext: %p(VA)\n", &_etext); @@ -794,9 +793,13 @@ void arch_init_mm(unsigned long* start_pfn_p, unsigned long* max_pfn_p) max_pfn = start_info.nr_pages; /* We need room for demand mapping and heap, clip available memory */ - virt_pfns = DEMAND_MAP_PAGES + HEAP_PAGES; - if ( max_pfn + virt_pfns + 1 < max_pfn ) - max_pfn = -(virt_pfns + 1); +#if defined(__i386__) + { + unsigned long virt_pfns = 1 + DEMAND_MAP_PAGES + 1 + HEAP_PAGES; + if (max_pfn + virt_pfns >= 0x100000) + max_pfn = 0x100000 - virt_pfns - 1; + } +#endif printk(" start_pfn: %lx\n", start_pfn); printk(" max_pfn: %lx\n", max_pfn);