From owner-svn-src-projects@FreeBSD.ORG Sat Oct 18 01:12:02 2008 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9384F106568B; Sat, 18 Oct 2008 01:12:02 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 827CB8FC19; Sat, 18 Oct 2008 01:12:02 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9I1C2jc002866; Sat, 18 Oct 2008 01:12:02 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9I1C2as002865; Sat, 18 Oct 2008 01:12:02 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200810180112.m9I1C2as002865@svn.freebsd.org> From: Kip Macy Date: Sat, 18 Oct 2008 01:12:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184007 - projects/releng_6_xen/sys/i386/xen X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Oct 2008 01:12:02 -0000 Author: kmacy Date: Sat Oct 18 01:12:02 2008 New Revision: 184007 URL: http://svn.freebsd.org/changeset/base/184007 Log: - allocate data structure pages from before the nkpt allocation - calculate the pre-allocated l1 pages by looking at the initial IdlePTD Modified: projects/releng_6_xen/sys/i386/xen/xen_machdep.c Modified: projects/releng_6_xen/sys/i386/xen/xen_machdep.c ============================================================================== --- projects/releng_6_xen/sys/i386/xen/xen_machdep.c Fri Oct 17 23:28:00 2008 (r184006) +++ projects/releng_6_xen/sys/i386/xen/xen_machdep.c Sat Oct 18 01:12:02 2008 (r184007) @@ -819,7 +819,7 @@ void initvalues(start_info_t *startinfo) { int l3_pages, l2_pages, l1_pages, offset; - vm_offset_t cur_space; + vm_offset_t cur_space, cur_space_pt; struct physdev_set_iopl set_iopl; vm_paddr_t KPTphys, IdlePTDma; @@ -873,6 +873,23 @@ initvalues(start_info_t *startinfo) cur_space += (4 * PAGE_SIZE); bootmem_end = (char *)cur_space; + /* allocate page for gdt */ + gdt = (union descriptor *)cur_space; + cur_space += PAGE_SIZE*ncpus; + + /* allocate page for ldt */ + ldt = (union descriptor *)cur_space; cur_space += PAGE_SIZE; + cur_space += PAGE_SIZE; + + HYPERVISOR_shared_info = (shared_info_t *)cur_space; + cur_space += PAGE_SIZE; + + xen_store = (struct ringbuf_head *)cur_space; + cur_space += PAGE_SIZE; + + console_page = (char *)cur_space; + cur_space += PAGE_SIZE; + #ifdef ADD_ISA_HOLE shift_phys_machine(xen_phys_machine, xen_start_info->nr_pages); #endif @@ -949,6 +966,16 @@ initvalues(start_info_t *startinfo) * Unpin the current PDPT */ xen_pt_unpin(IdlePDPTma); + + for (i = 0; i < l1_pages; i++) { + int startidx = ((KERNBASE >> 18) & PAGE_MASK) >> 3; + + if (IdlePTD[startidx + i] == 0) { + l1_pages = i - 1; + break; + } + } + #endif /* PAE */ /* unmap remaining pages from initial 4MB chunk @@ -960,7 +987,9 @@ initvalues(start_info_t *startinfo) } PT_UPDATES_FLUSH(); - + + + memcpy(((uint8_t *)IdlePTDnew) + ((unsigned int)(KERNBASE >> 18)), ((uint8_t *)IdlePTD) + ((KERNBASE >> 18) & PAGE_MASK), l1_pages*sizeof(pt_entry_t)); @@ -973,6 +1002,7 @@ initvalues(start_info_t *startinfo) xen_pgdpt_pin(xpmap_ptom(VTOP(IdlePDPTnew))); /* allocate remainder of nkpt pages */ + cur_space_pt = cur_space; for (offset = (KERNBASE >> PDRSHIFT), i = l1_pages; i < nkpt; i++, cur_space += PAGE_SIZE) { pdir = (offset + i) / NPDEPG; @@ -984,9 +1014,10 @@ initvalues(start_info_t *startinfo) * 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, (vm_paddr_t)0); + PT_SET_MA(cur_space_pt, + xpmap_ptom(VTOP(cur_space)) | PG_V | PG_RW); + bzero((char *)cur_space_pt, PAGE_SIZE); + PT_SET_MA(cur_space_pt, (vm_paddr_t)0); xen_pt_pin(xpmap_ptom(VTOP(cur_space))); xen_queue_pt_update((vm_paddr_t)(IdlePTDnewma[pdir] + curoffset*sizeof(vm_paddr_t)), @@ -1009,17 +1040,6 @@ initvalues(start_info_t *startinfo) IdlePDPT = IdlePDPTnew; IdlePDPTma = IdlePDPTnewma; - /* allocate page for gdt */ - gdt = (union descriptor *)cur_space; - cur_space += PAGE_SIZE*ncpus; - - /* allocate page for ldt */ - ldt = (union descriptor *)cur_space; cur_space += PAGE_SIZE; - cur_space += PAGE_SIZE; - - HYPERVISOR_shared_info = (shared_info_t *)cur_space; - cur_space += PAGE_SIZE; - /* * shared_info is an unsigned long so this will randomly break if * it is allocated above 4GB - I guess people are used to that @@ -1030,13 +1050,9 @@ initvalues(start_info_t *startinfo) printk("#4\n"); - xen_store = (struct ringbuf_head *)cur_space; - cur_space += PAGE_SIZE; xen_store_ma = (((vm_paddr_t)xen_start_info->store_mfn) << PAGE_SHIFT); PT_SET_MA(xen_store, xen_store_ma | PG_KERNEL); - console_page = (char *)cur_space; - cur_space += PAGE_SIZE; console_page_ma = (((vm_paddr_t)xen_start_info->console.domU.mfn) << PAGE_SHIFT); PT_SET_MA(console_page, console_page_ma | PG_KERNEL);