From 42e68d4d748cee2d96be49f4c66e3034ff4a3278 Mon Sep 17 00:00:00 2001 From: Kip Macy Date: Tue, 2 Sep 2008 02:55:45 +0000 Subject: [PATCH] Accomodate the fact that the number of l1 pages varies with the size of the initially allocated memory - this lets us boot with 3GB MFC after: 1 month --- sys/i386/xen/xen_machdep.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/i386/xen/xen_machdep.c b/sys/i386/xen/xen_machdep.c index 0a6602f681b2..ee589cf90c51 100644 --- a/sys/i386/xen/xen_machdep.c +++ b/sys/i386/xen/xen_machdep.c @@ -861,7 +861,8 @@ initvalues(start_info_t *startinfo) l3_pages = 0; #endif l2_pages = 1; - l1_pages = 4; /* XXX not certain if this varies */ + l1_pages = xen_start_info->nr_pt_frames - l2_pages - l3_pages; + KPTphysoff = (l2_pages + l3_pages)*PAGE_SIZE; KPTphys = xpmap_ptom(VTOP(startinfo->pt_base + KPTphysoff)); @@ -916,7 +917,9 @@ initvalues(start_info_t *startinfo) xen_pt_unpin(IdlePDPTma); #endif /* PAE */ - /* unmap remaining pages from initial 4MB chunk */ + /* unmap remaining pages from initial 4MB chunk + * + */ for (tmpva = cur_space; (tmpva & ((1<<22)-1)) != 0; tmpva += PAGE_SIZE) { bzero((char *)tmpva, PAGE_SIZE); PT_SET_MA(tmpva, (vm_paddr_t)0); @@ -931,12 +934,12 @@ initvalues(start_info_t *startinfo) /* allocate remainder of NKPT pages */ for (i = l1_pages; i < NKPT; i++, cur_space += PAGE_SIZE) { /* - * ensure that all page table pages have been zeroed + * make sure that all the initial page table pages + * have been zeroed */ PT_SET_MA(cur_space, xpmap_ptom(VTOP(cur_space)) | PG_V | PG_RW); bzero((char *)cur_space, PAGE_SIZE); - PT_SET_MA(cur_space, 0); - + PT_SET_MA(cur_space, (vm_paddr_t)0); xen_pt_pin(xpmap_ptom(VTOP(cur_space))); xen_queue_pt_update((vm_paddr_t)(IdlePTDma + (offset + i)*sizeof(vm_paddr_t)), xpmap_ptom(VTOP(cur_space)) | PG_KERNEL);