Date: Mon, 21 Jan 2008 22:43:11 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 133821 for review Message-ID: <200801212243.m0LMhB0Q012998@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801212243.m0LMhB0Q012998>