PERFORCE change 28465 for review
Peter Wemm
peter at FreeBSD.org
Mon Apr 7 17:18:00 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=28465
Change 28465 by peter at peter_daintree on 2003/04/07 17:17:24
remove most debug printfs, we get past here now.
Affected files ...
.. //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#45 edit
Differences ...
==== //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#45 (text+ko) ====
@@ -141,7 +141,7 @@
u_int64_t IdlePML4; /* phys addr of kernel level 4 */
struct user *proc0uarea; /* address of proc 0 uarea space */
vm_offset_t proc0kstack; /* address of proc 0 kstack space */
-
+
int cold = 1;
long Maxmem = 0;
@@ -712,7 +712,7 @@
sd->sd_p = ssd->ssd_p;
sd->sd_gran = ssd->ssd_gran;
}
-
+
#define PHYSMAP_SIZE (2 * 8)
@@ -774,12 +774,10 @@
smap->type, smap->base, smap->length);
if (smap->type != 0x01) {
-printf("bad type\n");
continue;
}
if (smap->length == 0) {
-printf("bad length\n");
next_run:
continue;
}
@@ -795,7 +793,6 @@
if (smap->base == physmap[physmap_idx + 1]) {
physmap[physmap_idx + 1] += smap->length;
-printf("contiguous\n");
continue;
}
@@ -808,7 +805,6 @@
physmap[physmap_idx] = smap->base;
physmap[physmap_idx + 1] = smap->base + smap->length;
}
-printf("MADE IT TO END!!\n");
/*
* Perform "base memory" related probes & setup based on SMAP
@@ -876,7 +872,6 @@
/*
* Now, physmap contains a map of physical memory.
*/
-printf("physmap_done\n");
printf("physmap_idx = %d\n", physmap_idx);
for (i = 0; i <= physmap_idx; i += 2) {
printf("slot %d: 0x%16lx - 0x%16lx\n", i/2, physmap[i], physmap[i + 1]);
@@ -885,7 +880,7 @@
/*
* Maxmem isn't the "maximum memory", it's one larger than the
* highest page of the physical address space. It should be
- * called something like "Maxphyspage". We may adjust this
+ * called something like "Maxphyspage". We may adjust this
* based on ``hw.physmem'' and the results of the memory test.
*/
Maxmem = atop(physmap[physmap_idx + 1]);
@@ -894,7 +889,6 @@
Maxmem = MAXMEM / 4;
#endif
-printf("checking hw.physmem...\n");
/*
* hw.physmem is a size in bytes; we also allow k, m, and g suffixes
* for the appropriate modifiers. This overrides MAXMEM.
@@ -936,14 +930,12 @@
/*
* If Maxmem has been increased beyond what the system has detected,
* extend the last memory segment to the new limit.
- */
+ */
if (atop(physmap[physmap_idx + 1]) < Maxmem)
physmap[physmap_idx + 1] = ptoa((vm_paddr_t)Maxmem);
-printf("about to call pmap_bootstrap...\n\n");
/* call pmap initialization to make new kernel address space */
pmap_bootstrap(first, 0);
-printf("pmap_bootstrap done...\n");
/*
* Size up each available chunk of physical memory.
@@ -973,7 +965,7 @@
*/
if (pa >= 0x100000 && pa < first)
continue;
-
+
page_bad = FALSE;
/*
@@ -1071,7 +1063,6 @@
phys_avail[pa_indx] -= round_page(MSGBUF_SIZE);
avail_end = phys_avail[pa_indx];
-printf("getmemsize finished!\n");
}
static u_int64_t
@@ -1096,9 +1087,9 @@
/* Allocate pages */
KPTphys = allocpages(NKPT);
printf("KPTphys = 0x%lx\n", KPTphys);
- IdlePML4 = allocpages(1);
+ IdlePML4 = allocpages(NKPML4E);
printf("IdlePML4 = 0x%lx\n", IdlePML4);
- IdlePDP = allocpages(1);
+ IdlePDP = allocpages(NKPDPE);
printf("IdlePDP = 0x%lx\n", IdlePDP);
IdlePTD = allocpages(NPGPTD);
printf("IdlePTD = 0x%lx\n", IdlePTD);
@@ -1117,14 +1108,16 @@
/* XXX not actually used, underneath 2M pages */
for (i = 0; (i << PAGE_SHIFT) < physfree; i++) {
((pt_entry_t *)KPTphys)[i] = i << PAGE_SHIFT;
- ((pt_entry_t *)KPTphys)[i] |= PG_RW;
+ ((pt_entry_t *)KPTphys)[i] |= PG_RW | PG_V;
}
-
+
+#if 0
/* Map from zero to end of allocations under 2M pages */
for (i = 0; (i << PDRSHIFT) < physfree; i++) {
((pd_entry_t *)IdlePTD)[i] = i << PDRSHIFT;
((pd_entry_t *)IdlePTD)[i] |= PG_RW | PG_V | PG_PS;
}
+#endif
/* Now map the page tables at their location within PTmap */
for (i = 0; i < NKPT; i++) {
@@ -1132,6 +1125,12 @@
((pd_entry_t *)IdlePTD)[i + KPTDI] |= PG_RW | PG_V;
}
+ /* Now map the page tables at their location within PTmap */
+ for (i = 0; i < NKPT; i++) {
+ ((pd_entry_t *)IdlePTD)[i] = KPTphys + (i << PAGE_SHIFT);
+ ((pd_entry_t *)IdlePTD)[i] |= PG_RW | PG_V;
+ }
+
/* Now map the PTD at the top of the PTmap (ie: PTD[]) */
for (i = 0; i < NPGPTD; i++) {
((pd_entry_t *)IdlePTD)[i + PTDPTDI] = IdlePTD + (i << PAGE_SHIFT);
@@ -1139,9 +1138,10 @@
}
/* And connect up the PTD to the PDP */
- /* XXX index 1 == 1GB, where the KERNBASE is for now */
- ((pdp_entry_t *)IdlePDP)[1] = IdlePTD;
- ((pdp_entry_t *)IdlePDP)[1] |= PG_RW | PG_V;
+ for (i = 0; i < NPGPTD; i++) {
+ ((pdp_entry_t *)IdlePDP)[i] = IdlePTD + (i << PAGE_SHIFT);
+ ((pdp_entry_t *)IdlePDP)[i] |= PG_RW | PG_V | PG_U;
+ }
/* And connect up the PDP to the PML4 */
((pdp_entry_t *)IdlePML4)[0] = IdlePDP;
@@ -1158,7 +1158,6 @@
u_int64_t first;
first = physfree;
-printf("It is hammer_time!\n");
create_pagetables();
@@ -1201,10 +1200,8 @@
r_gdt.rd_limit = NGDT * sizeof(gdt[0]) - 1;
r_gdt.rd_base = (long) gdt;
lgdt(&r_gdt);
-printf("lgdt done\n");
- pc = &__pcpu;
+ pc = &__pcpu;
-printf("setting MSR_FSBASE and GSBASE to %p\n", pc);
wrmsr(MSR_FSBASE, (u_int64_t)pc);
wrmsr(MSR_GSBASE, (u_int64_t)pc);
@@ -1275,13 +1272,11 @@
r_idt.rd_limit = sizeof(idt0) - 1;
r_idt.rd_base = (long) idt;
lidt(&r_idt);
-printf("survived lidt!\n");
/*
* Initialize the console before we print anything out.
*/
cninit();
-printf("done cninit\n");
#ifdef DEV_ISA
isa_defaultirq();
@@ -1306,13 +1301,9 @@
/* make an initial tss so cpu can get interrupt stack on syscall! */
common_tss.tss.tss_rsp0 = thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE - sizeof(struct pcb);
-printf("thread0.td_kstack = %p\n", thread0.td_kstack);
-printf("tss_rsp0 = %p\n", common_tss.tss.tss_rsp0);
-printf("about to ltr\n");
gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
ltr(gsel_tss);
-printf("survived ltr!\n");
#if 0
dblfault_tss.tss_esp = dblfault_tss.tss_esp0 = dblfault_tss.tss_esp1 =
@@ -1331,29 +1322,22 @@
dblfault_tss.tss_cs = GSEL(GCODE_SEL, SEL_KPL);
#endif
-printf("calling getmemsize\n");
getmemsize(kmdp, first);
-printf("calling init_param2\n");
init_param2(physmem);
/* now running on new page tables, configured,and u/iom is accessible */
-printf("map message buffer\n");
/* Map the message buffer. */
for (off = 0; off < round_page(MSGBUF_SIZE); off += PAGE_SIZE)
pmap_kenter((vm_offset_t)msgbufp + off, avail_end + off);
-printf("calling msgbufinit\n");
msgbufinit(msgbufp, MSGBUF_SIZE);
-printf("setup proc0\n");
/* setup proc 0's pcb */
thread0.td_pcb->pcb_flags = 0; /* XXXKSE */
thread0.td_pcb->pcb_cr3 = IdlePML4;
thread0.td_frame = &proc0_tf;
-printf("HAMMER TIME!!\n");
-printf("HALT\n\n"); for(;;);
}
void
More information about the p4-projects
mailing list