PERFORCE change 133829 for review
Oleksandr Tymoshenko
gonzo at FreeBSD.org
Mon Jan 21 15:53:26 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=133829
Change 133829 by gonzo at gonzo_jeeves on 2008/01/21 23:52:06
o Do not use cpu_thread_alloc to set td_pcb and td_frame.
Besides setting these fields cpu_thread_alloc fills out
md_upte array with PTEs of kstack pages to make them wired
in cpu_switch routine. thread0 has it's kstack allocated by
pmap_steal_memory so it belongs to KSEG0.
Affected files ...
.. //depot/projects/mips2-jnpr/src/sys/mips/mips/machdep.c#18 edit
Differences ...
==== //depot/projects/mips2-jnpr/src/sys/mips/mips/machdep.c#18 (text+ko) ====
@@ -270,7 +270,20 @@
#else
pcpu_init(pcpup, 0, sizeof(struct pcpu));
#endif
- cpu_thread_alloc(&thread0);
+ /*
+ * Do not use cpu_thread_alloc to initialize these fields
+ * thread0 is the only thread that has kstack located in KSEG0
+ * while cpu_thread_alloc handles kstack allocated in KSEG2.
+ */
+ thread0.td_pcb = (struct pcb *)(thread0.td_kstack +
+ thread0.td_kstack_pages * PAGE_SIZE) - 1;
+ thread0.td_frame = &thread0.td_pcb->pcb_regs;
+ /*
+ * There is no need to initialize md_upte array for thread0 as it's
+ * located in .bss section and should be explicitly zeroed during
+ * kernel initialization.
+ */
+
PCPU_SET(curthread, &thread0);
PCPU_SET(curpcb, thread0.td_pcb);
}
More information about the p4-projects
mailing list