ia64/xen-unstable

changeset 19290:5a981686bbf8

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 <samuel.thibault@ens-lyon.org>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Mar 09 08:43:11 2009 +0000 (2009-03-09)
parents dd489125a2e7
children 9ed53e602119
files extras/mini-os/arch/x86/mm.c
line diff
     1.1 --- a/extras/mini-os/arch/x86/mm.c	Fri Mar 06 19:18:39 2009 +0000
     1.2 +++ b/extras/mini-os/arch/x86/mm.c	Mon Mar 09 08:43:11 2009 +0000
     1.3 @@ -778,8 +778,7 @@ void arch_init_p2m(unsigned long max_pfn
     1.4  
     1.5  void arch_init_mm(unsigned long* start_pfn_p, unsigned long* max_pfn_p)
     1.6  {
     1.7 -
     1.8 -    unsigned long start_pfn, max_pfn, virt_pfns;
     1.9 +    unsigned long start_pfn, max_pfn;
    1.10  
    1.11      printk("      _text: %p(VA)\n", &_text);
    1.12      printk("     _etext: %p(VA)\n", &_etext);
    1.13 @@ -794,9 +793,13 @@ void arch_init_mm(unsigned long* start_p
    1.14      max_pfn = start_info.nr_pages;
    1.15  
    1.16      /* We need room for demand mapping and heap, clip available memory */
    1.17 -    virt_pfns = DEMAND_MAP_PAGES + HEAP_PAGES;
    1.18 -    if ( max_pfn + virt_pfns + 1 < max_pfn )
    1.19 -        max_pfn = -(virt_pfns + 1);
    1.20 +#if defined(__i386__)
    1.21 +    {
    1.22 +        unsigned long virt_pfns = 1 + DEMAND_MAP_PAGES + 1 + HEAP_PAGES;
    1.23 +        if (max_pfn + virt_pfns >= 0x100000)
    1.24 +            max_pfn = 0x100000 - virt_pfns - 1;
    1.25 +    }
    1.26 +#endif
    1.27  
    1.28      printk("  start_pfn: %lx\n", start_pfn);
    1.29      printk("    max_pfn: %lx\n", max_pfn);