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
This commit is contained in:
Kip Macy 2008-09-02 02:55:45 +00:00
parent 20a94ecc79
commit 42e68d4d74

View File

@ -861,7 +861,8 @@ initvalues(start_info_t *startinfo)
l3_pages = 0; l3_pages = 0;
#endif #endif
l2_pages = 1; 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; KPTphysoff = (l2_pages + l3_pages)*PAGE_SIZE;
KPTphys = xpmap_ptom(VTOP(startinfo->pt_base + KPTphysoff)); KPTphys = xpmap_ptom(VTOP(startinfo->pt_base + KPTphysoff));
@ -916,7 +917,9 @@ initvalues(start_info_t *startinfo)
xen_pt_unpin(IdlePDPTma); xen_pt_unpin(IdlePDPTma);
#endif /* PAE */ #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) { for (tmpva = cur_space; (tmpva & ((1<<22)-1)) != 0; tmpva += PAGE_SIZE) {
bzero((char *)tmpva, PAGE_SIZE); bzero((char *)tmpva, PAGE_SIZE);
PT_SET_MA(tmpva, (vm_paddr_t)0); PT_SET_MA(tmpva, (vm_paddr_t)0);
@ -931,12 +934,12 @@ initvalues(start_info_t *startinfo)
/* allocate remainder of NKPT pages */ /* allocate remainder of NKPT pages */
for (i = l1_pages; i < NKPT; i++, cur_space += PAGE_SIZE) { 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); PT_SET_MA(cur_space, xpmap_ptom(VTOP(cur_space)) | PG_V | PG_RW);
bzero((char *)cur_space, PAGE_SIZE); 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_pt_pin(xpmap_ptom(VTOP(cur_space)));
xen_queue_pt_update((vm_paddr_t)(IdlePTDma + (offset + i)*sizeof(vm_paddr_t)), xen_queue_pt_update((vm_paddr_t)(IdlePTDma + (offset + i)*sizeof(vm_paddr_t)),
xpmap_ptom(VTOP(cur_space)) | PG_KERNEL); xpmap_ptom(VTOP(cur_space)) | PG_KERNEL);