[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] minios: Clip memory not usable by Mini-OS (above 1GB)



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1228482417 0
# Node ID 4ffd935c08a3e88fa67328efc4f7bbdbce4a162b
# Parent  eed39afde7dd52d623d8c1a0f659507ac630d9fc
minios: Clip memory not usable by Mini-OS (above 1GB)

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
---
 extras/mini-os/arch/x86/mm.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff -r eed39afde7dd -r 4ffd935c08a3 extras/mini-os/arch/x86/mm.c
--- a/extras/mini-os/arch/x86/mm.c      Fri Dec 05 13:03:44 2008 +0000
+++ b/extras/mini-os/arch/x86/mm.c      Fri Dec 05 13:06:57 2008 +0000
@@ -420,7 +420,9 @@ static unsigned long demand_map_area_sta
 #define DEMAND_MAP_PAGES ((2ULL << 30) / PAGE_SIZE)
 #endif
 
-#ifdef HAVE_LIBC
+#ifndef HAVE_LIBC
+#define HEAP_PAGES 0
+#else
 unsigned long heap, brk, heap_mapped, heap_end;
 #ifdef __x86_64__
 #define HEAP_PAGES ((128ULL << 30) / PAGE_SIZE)
@@ -591,7 +593,7 @@ void arch_init_mm(unsigned long* start_p
 void arch_init_mm(unsigned long* start_pfn_p, unsigned long* max_pfn_p)
 {
 
-    unsigned long start_pfn, max_pfn;
+    unsigned long start_pfn, max_pfn, virt_pfns;
 
     printk("  _text:        %p\n", &_text);
     printk("  _etext:       %p\n", &_etext);
@@ -604,7 +606,12 @@ void arch_init_mm(unsigned long* start_p
     start_pfn = PFN_UP(to_phys(start_info.pt_base)) + 
                 start_info.nr_pt_frames + 3;
     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);
+
     printk("  start_pfn:    %lx\n", start_pfn);
     printk("  max_pfn:      %lx\n", max_pfn);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.