PERFORCE change 90907 for review
Kip Macy
kmacy at FreeBSD.org
Wed Feb 1 15:40:39 PST 2006
http://perforce.freebsd.org/chv.cgi?CH=90907
Change 90907 by kmacy at kmacy:freebsd7_xen3 on 2006/02/01 23:39:38
it turns out that doing the ISA hole shifting at the P2M interface
would require too many changes to pmap.c
this change shifts all the P2M mappings up by 4MB at init time
when ADD_ISA_HOLE is set - this effectively throws away the upper
4MB of machine addresses that we are given
Affected files ...
.. //depot/projects/xen3/src/sys/i386-xen/i386-xen/xen_machdep.c#9 edit
.. //depot/projects/xen3/src/sys/i386-xen/include/xenvar.h#6 edit
Differences ...
==== //depot/projects/xen3/src/sys/i386-xen/i386-xen/xen_machdep.c#9 (text+ko) ====
@@ -554,6 +554,36 @@
static vm_offset_t *pdir_shadow;
+#ifdef ADD_ISA_HOLE
+static void
+shift_phys_machine(unsigned long *phys_machine, int nr_pages)
+{
+ unsigned long *tmp_page, *current_page, *next_page;
+ int i;
+
+ tmp_page = bootmem_alloc(PAGE_SIZE);
+ current_page = phys_machine;
+ next_page = phys_machine + (PAGE_SIZE/sizeof(unsigned long));
+ bcopy(current_page, tmp_page, PAGE_SIZE);
+
+ for (i = 0; i < (nr_pages - 1024); i++) {
+ xen_machphys_update(phys_machine[i], i + 1024);
+ }
+ while (next_page < (phys_machine + nr_pages)) {
+ bcopy(tmp_page, current_page, PAGE_SIZE);
+ bcopy(next_page, tmp_page, PAGE_SIZE);
+
+ current_page += (PAGE_SIZE/sizeof(unsigned long));
+ next_page += (PAGE_SIZE/sizeof(unsigned long));
+ }
+ bootmem_free(tmp_page, PAGE_SIZE);
+
+
+ memset(phys_machine, INVALID_P2M_ENTRY, PAGE_SIZE);
+
+}
+#endif
+
void
initvalues(start_info_t *startinfo)
{
@@ -575,6 +605,15 @@
/* number of pages allocated after the pts + 1*/;
unsigned long tmpindex = (VTOPFN(xen_start_info->pt_base) + xen_start_info->nr_pt_frames) + 3;
xendebug_flags = 0xffffffff;
+
+ /* allocate 4 pages for bootmem allocator */
+ bootmem_start = bootmem_current = (char *)PFNTOV(tmpindex);
+ tmpindex += 4;
+ bootmem_end = (char *)PFNTOV(tmpindex);
+
+#ifdef ADD_ISA_HOLE
+ shift_phys_machine(xen_phys_machine, xen_start_info->nr_pages);
+#endif
/*
* pre-zero unused mapped pages - mapped on 4MB boundary
*/
@@ -606,11 +645,6 @@
ldt = (union descriptor *)PFNTOV(tmpindex);
tmpindex++;
- /* allocate 4 pages for bootmem allocator */
- bootmem_start = bootmem_current = (char *)PFNTOV(tmpindex);
- tmpindex += 4;
- bootmem_end = (char *)PFNTOV(tmpindex);
-
/* initialize page directory shadow page */
pdir_shadow = (vm_offset_t *)PFNTOV(tmpindex);
i686_pagezero(pdir_shadow);
==== //depot/projects/xen3/src/sys/i386-xen/include/xenvar.h#6 (text+ko) ====
@@ -28,8 +28,8 @@
#endif
-#define PFNTOMFN(i) (((unsigned long *)xen_phys_machine)[(i) - ISA_INDEX_OFFSET])
-#define MFNTOPFN(i) (xen_machine_phys[i] + ISA_INDEX_OFFSET)
+#define PFNTOMFN(i) (((unsigned long *)xen_phys_machine)[(i)])
+#define MFNTOPFN(i) (xen_machine_phys[i])
#define VTOP(x) ((unsigned long)(x) - KERNBASE)
#define PTOV(x) ((unsigned long)(x) + KERNBASE)
More information about the p4-projects
mailing list