]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/mini-os.git/commitdiff
minios: Fix 18874 memory clipping
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 9 Mar 2009 08:43:11 +0000 (08:43 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 9 Mar 2009 08:43:11 +0000 (08:43 +0000)
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 <samuel.thibault@ens-lyon.org>
arch/x86/mm.c

index 6a2cb351f3accfb82ec1e58e2bc9a182491d1d28..fd7af71e01fd5354bb9294d4db643a30be1f00f8 100644 (file)
@@ -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);