From owner-p4-projects@FreeBSD.ORG Mon Jan 21 23:53:25 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C6D4816A41B; Mon, 21 Jan 2008 23:53:25 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 470B916A41A for ; Mon, 21 Jan 2008 23:53:25 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 3350213C45D for ; Mon, 21 Jan 2008 23:53:25 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m0LNrPR6026834 for ; Mon, 21 Jan 2008 23:53:25 GMT (envelope-from gonzo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m0LNrOBo026828 for perforce@freebsd.org; Mon, 21 Jan 2008 23:53:24 GMT (envelope-from gonzo@FreeBSD.org) Date: Mon, 21 Jan 2008 23:53:24 GMT Message-Id: <200801212353.m0LNrOBo026828@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko To: Perforce Change Reviews Cc: Subject: PERFORCE change 133829 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jan 2008 23:53:26 -0000 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); }