pv_grub and >1023M RAM == death
pv_grub x86, when booted with more than 1023MB of RAM, will produce the following output:
Xen Minimal OS!
start_info: 0xa72000 nr_pages: 276480 shared_inf: cfdca000 pt_base: 0xa75000 mod_start: 0x0 mod_len: 0 flags: 0x0 cmd_line: (hd0)/boot/grub/menu.lst stack: 0x943780-0x963780 MM: Init _text: 0x0 _etext: 0x5f0ca _erodata: 0x73000 _edata: 0x786d4 stack start: 0x943780 _end: 0x963d14 start_pfn: a81 max_pfn: 43800
Mapping memory range 0xc00000 - 0x43800000
setting 0x0-0x73000 readonly
skipped 0x1000
MM: Initialise page allocator for c98000(c98000)-0(43800000)
MM: done
Demand map pfns at 43801000-c3801000.
Heap resides at c3802000-3802000.
Initialising timer interface
Initialising console ... done.gnttab_table mapped at 0x43801000.
Initialising scheduler
Heap exhausted: 0xc3802000 + 480 = 0xc3802480 > 0x3802000
Heap exhausted: 0xc3802000 + b80 = 0xc3802b80 > 0x3802000
Page fault at linear address 0x4, eip 0x519fd, regs 0x95fea8, sp 0x77da0, our_sp 0x95fe88, code 2 Page fault in pagetable walk (access to invalid memory?).
-Chris
Hello,
Quoted 2 lines · Christopher S. Aker, le Wed 03 Dec 2008 14:05:55 -0500, a écrit :
pv_grubx86, when booted with more than 1023MB of RAM, will produce the following output:
Ah, mini-os doesn't have any protection against that. I don't have a machine here to test, could you check the patch below?
Samuel
Clip memory not usable by Mini-OS (above 1GB)
extras/mini-os/arch/x86/mm.c +10 -3
@@ -420,7 +420,9 @@#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_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 @@ 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);