PERFORCE change 105084 for review
Jue Yuan
yuanjue at FreeBSD.org
Sat Aug 26 05:13:07 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=105084
Change 105084 by yuanjue at maver-freebsd on 2006/08/26 05:12:28
now the kernel should support larger mfsroot initially.
MFS_CHUNKS macro is used for it.
a mfsroot embedded kernel has been built successfully and
is workable, although more tests are needed.
Affected files ...
.. //depot/projects/soc2006/yuanjue-xen3/src/sys/i386-xen/i386-xen/xen_machdep.c#3 edit
.. //depot/projects/soc2006/yuanjue-xen3/src/sys/i386-xen/include/xenvar.h#3 edit
Differences ...
==== //depot/projects/soc2006/yuanjue-xen3/src/sys/i386-xen/i386-xen/xen_machdep.c#3 (text+ko) ====
@@ -612,6 +612,10 @@
int j;
#endif
+#ifdef ADD_MFS_ROOT
+ int k;
+#endif
+
#ifdef WRITABLE_PAGETABLES
printk("using writable pagetables\n");
HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
@@ -634,14 +638,14 @@
#endif
/*
* pre-zero unused mapped pages - mapped on 4MB boundary
- * mapped on 8MB boundary if mfsroot is embedded in kernel
+ * mapped on demand via MFS_CHUNKS if mfsroot is embedded in kernel
*/
#ifndef PAE
#ifndef ADD_MFS_ROOT
round_tmpindex = (((tmpindex - 1) / 1024) + 1) * 1024;
#else
- round_tmpindex = (((tmpindex - 1) / 1024) + 2) * 1024;
+ round_tmpindex = (((tmpindex - 1) / 1024) + MFS_CHUNKS + 1) * 1024;
#endif
#endif
@@ -694,10 +698,11 @@
xen_queue_pt_update(pdir_shadow_ma + (KPTDI + ISA_PDR_OFFSET)*sizeof(vm_paddr_t),
KPTphys | PG_V | PG_A);
- /*we need at least one more 4MB for mfsroot embedded in kernel*/
+ /* we need MFS_CHUNKS of 4MB for mfsroot embedded in kernel */
#ifdef ADD_MFS_ROOT
- xen_queue_pt_update(pdir_shadow_ma + (KPTDI + ISA_PDR_OFFSET + 1)*sizeof(vm_paddr_t),
- xpmap_ptom(VTOP(startinfo->pt_base + (2 * PAGE_SIZE))) | PG_V | PG_A);
+ for (i = 0; i < MFS_CHUNKS; i++)
+ xen_queue_pt_update(pdir_shadow_ma + (KPTDI + ISA_PDR_OFFSET + 1)*sizeof(vm_paddr_t),
+ xpmap_ptom(VTOP(startinfo->pt_base + ((2+i) * PAGE_SIZE))) | PG_V | PG_A);
#endif
xen_flush_queue();
@@ -733,17 +738,20 @@
__asm__("int3");
#endif
/* unmap remaining pages from initial 4MB chunk
- * 8MB chunk if mfsroot is embedded in kernel
+ * (MFSCHUNK + 1)*4MB if mfsroot is embedded in kernel
*/
#ifndef ADD_MFS_ROOT
for (i = (tmpindex - ISA_INDEX_OFFSET); i%1024 != 0; i++)
xen_queue_pt_update(KPTphys + i*sizeof(vm_paddr_t), 0);
#else
- for (i = (tmpindex - ISA_INDEX_OFFSET); i%2048 != 0; i++) {
+ for (i = (tmpindex - ISA_INDEX_OFFSET); i % ((MFS_CHUNKS+1)*1024) != 0; i++) {
if (i < 1024)
xen_queue_pt_update(KPTphys + i*sizeof(vm_paddr_t), 0);
else
- xen_queue_pt_update(xpmap_ptom(VTOP(startinfo->pt_base + (2 * PAGE_SIZE))) + (i-1024)*sizeof(vm_paddr_t), 0);
+ {
+ for (k = 0; k < MFS_CHUNKS; k++)
+ xen_queue_pt_update(xpmap_ptom(VTOP(startinfo->pt_base + ((2+k) * PAGE_SIZE))) + (i - 1024*(k+1))*sizeof(vm_paddr_t), 0);
+ }
}
#endif
xen_flush_queue();
@@ -758,12 +766,12 @@
xpmap_ptom((tmpindex << PAGE_SHIFT)| PG_V | PG_A));
}
#else
- for (i = 0; i < NKPT - 2; i++, tmpindex++) {
- /*if mfsroot embedded, 2 PDE has used for bootstrap already*/
- xen_queue_pt_update((vm_paddr_t)(IdlePTDma + KPTDI + i + 2 + ISA_PDR_OFFSET),
+ for (i = 0; i < NKPT - (1 + MFS_CHUNKS); i++, tmpindex++) {
+ /* if mfsroot embedded, (1+MFS_CHUNKS) numbers of PDE has used for bootstrap already */
+ xen_queue_pt_update((vm_paddr_t)(IdlePTDma + KPTDI + i + 1 + MFS_CHUNKS + ISA_PDR_OFFSET),
xpmap_ptom((tmpindex << PAGE_SHIFT)| PG_KERNEL));
- xen_queue_pt_update(pdir_shadow_ma + (KPTDI + i + 2 + ISA_PDR_OFFSET)*sizeof(vm_paddr_t),
- xpmap_ptom((tmpindex << PAGE_SHIFT)| PG_V | PG_A));
+ xen_queue_pt_update(pdir_shadow_ma + (KPTDI + i + 1 + MFS_CHUNKS + ISA_PDR_OFFSET)
+ *sizeof(vm_paddr_t), xpmap_ptom((tmpindex << PAGE_SHIFT)| PG_V | PG_A));
}
#endif
tmpindex += NKPT-1;
==== //depot/projects/soc2006/yuanjue-xen3/src/sys/i386-xen/include/xenvar.h#3 (text+ko) ====
@@ -19,7 +19,7 @@
* FreeBSD doesn't
*/
-#if 0 /*we don't need this for domU*/
+#if 0 /* for domU, we could ignore this safely */
#define ADD_ISA_HOLE
#endif
@@ -31,10 +31,22 @@
#define ISA_PDR_OFFSET 0
#endif
+/* If we embedded mfsroot into kernel, then
+ * we could get a domU_INSTALL kernel
+ * NOTE: if it ISN'T needed, remember to make it
+ * undefined
+ */
#if 1
#define ADD_MFS_ROOT
#endif
+#ifdef ADD_MFS_ROOT
+/* MFS_CHUNKS could be modified for larger size mfsroot requirement.
+ * memory space for mfsroot would be (MFS_CHUNKS * 4MB)
+ */
+#define MFS_CHUNKS 1
+#endif
+
#define PFNTOMFN(i) (((unsigned long *)xen_phys_machine)[(i)])
#define MFNTOPFN(i) (xen_machine_phys[i])
More information about the p4-projects
mailing list