From owner-p4-projects@FreeBSD.ORG Mon Jan 21 22:43:12 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E6D2916A41B; Mon, 21 Jan 2008 22:43:11 +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 7CD6F16A418 for ; Mon, 21 Jan 2008 22:43:11 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 56D7D13C467 for ; Mon, 21 Jan 2008 22:43:11 +0000 (UTC) (envelope-from imp@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 m0LMhBW1013005 for ; Mon, 21 Jan 2008 22:43:11 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m0LMhB0Q012998 for perforce@freebsd.org; Mon, 21 Jan 2008 22:43:11 GMT (envelope-from imp@freebsd.org) Date: Mon, 21 Jan 2008 22:43:11 GMT Message-Id: <200801212243.m0LMhB0Q012998@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 133821 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 22:43:12 -0000 http://perforce.freebsd.org/chv.cgi?CH=133821 Change 133821 by imp@imp_lighthouse on 2008/01/21 22:42:30 Cope with kstack0 being in KSEG0. I'm not sure this is right, but it may be right enough for the moment. gonzo@ is trying to puzzle out if this is good or not. Affected files ... .. //depot/projects/mips2-jnpr/src/sys/mips/mips/vm_machdep.c#8 edit Differences ... ==== //depot/projects/mips2-jnpr/src/sys/mips/mips/vm_machdep.c#8 (text+ko) ==== @@ -140,13 +140,22 @@ td2->td_frame->v1 = 1; td2->td_frame->a3 = 0; - if (!(pte = pmap_segmap(kernel_pmap, (vm_offset_t)td2->td_kstack))) - panic("cpu_fork: invalid segmap"); - pte += ((vm_offset_t)td2->td_kstack >> PGSHIFT) & (NPTEPG - 1); - - for (i = 0; i < KSTACK_PAGES; i++) { - td2->td_md.md_upte[i] = *pte & ~(PG_RO|PG_WIRED); - pte++; + /* + * thread 0 has its stack in KSEG0 space. In that case, there's + * nothing to do since we're not going to change the physical address + * of where we're swapped in at... + */ + pte = pmap_segmap(kernel_pmap, (vm_offset_t)td2->td_kstack; + if (pte == NULL) { + if ((vm_offset_t)td->td_kstack < MIPS_KSEG0_START && + (vm_offset_t)td->td_kstack > MIPS_KSEG0_END) + panic("cpu_fork: invalid segmap"); + } else { + pte += ((vm_offset_t)td2->td_kstack >> PGSHIFT) & (NPTEPG - 1); + for (i = 0; i < KSTACK_PAGES; i++) { + td2->td_md.md_upte[i] = *pte & ~(PG_RO|PG_WIRED); + pte++; + } } if (td1 == PCPU_GET(fpcurthread)) @@ -249,6 +258,15 @@ td->td_kstack_pages * PAGE_SIZE) - 1; td->td_frame = &td->td_pcb->pcb_regs; + /* + * thread 0 has its stack in KSEG0 space. In that case, there's + * nothing to do since we're not going to change the physical address + * of where we're swapped in at... + */ + if ((vm_offset_t)td->td_kstack > MIPS_KSEG0_START && + (vm_offset_t)td->td_kstack < MIPS_KSEG0_END) + return; + if (!(pte = pmap_segmap(kernel_pmap, (vm_offset_t)td->td_kstack))) panic("cpu_thread_alloc: invalid segmap"); pte += ((vm_offset_t)td->td_kstack >> PGSHIFT) & (NPTEPG - 1);