ia64/xen-unstable
changeset 18884:4ffd935c08a3
minios: Clip memory not usable by Mini-OS (above 1GB)
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Fri Dec 05 13:06:57 2008 +0000 (2008-12-05) |
parents | eed39afde7dd |
children | c520af4bde59 |
files | extras/mini-os/arch/x86/mm.c |
line diff
1.1 --- a/extras/mini-os/arch/x86/mm.c Fri Dec 05 13:03:44 2008 +0000 1.2 +++ b/extras/mini-os/arch/x86/mm.c Fri Dec 05 13:06:57 2008 +0000 1.3 @@ -420,7 +420,9 @@ static unsigned long demand_map_area_sta 1.4 #define DEMAND_MAP_PAGES ((2ULL << 30) / PAGE_SIZE) 1.5 #endif 1.6 1.7 -#ifdef HAVE_LIBC 1.8 +#ifndef HAVE_LIBC 1.9 +#define HEAP_PAGES 0 1.10 +#else 1.11 unsigned long heap, brk, heap_mapped, heap_end; 1.12 #ifdef __x86_64__ 1.13 #define HEAP_PAGES ((128ULL << 30) / PAGE_SIZE) 1.14 @@ -591,7 +593,7 @@ void arch_init_p2m(unsigned long max_pfn 1.15 void arch_init_mm(unsigned long* start_pfn_p, unsigned long* max_pfn_p) 1.16 { 1.17 1.18 - unsigned long start_pfn, max_pfn; 1.19 + unsigned long start_pfn, max_pfn, virt_pfns; 1.20 1.21 printk(" _text: %p\n", &_text); 1.22 printk(" _etext: %p\n", &_etext); 1.23 @@ -604,7 +606,12 @@ void arch_init_mm(unsigned long* start_p 1.24 start_pfn = PFN_UP(to_phys(start_info.pt_base)) + 1.25 start_info.nr_pt_frames + 3; 1.26 max_pfn = start_info.nr_pages; 1.27 - 1.28 + 1.29 + /* We need room for demand mapping and heap, clip available memory */ 1.30 + virt_pfns = DEMAND_MAP_PAGES + HEAP_PAGES; 1.31 + if (max_pfn + virt_pfns + 1 < max_pfn) 1.32 + max_pfn = -(virt_pfns + 1); 1.33 + 1.34 printk(" start_pfn: %lx\n", start_pfn); 1.35 printk(" max_pfn: %lx\n", max_pfn); 1.36