Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jan 2008 23:53:24 GMT
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 133829 for review
Message-ID:  <200801212353.m0LNrOBo026828@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=133829

Change 133829 by gonzo@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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801212353.m0LNrOBo026828>