Make sure proc0 PCB has spl0 condition in CP0 status register field.

cpu_fork() mistakenly created processes forked by proc0, including
kthreads, in splhigh condition, because [1] proc0's PCB was zero
cleared during initialization, and [2] value 0 in status register
field made processes to have splhigh condition when CPU tick was
assigned for them.  This mostly doesn't matter as forked processes
dive immediately into user mode through proc_trampoline code path,
however, kthreads never do that and remain in splhigh.

Reported by Ethan Solomita <ethan@geocast.com>.
This commit is contained in:
nisimura 2000-03-25 10:14:13 +00:00
parent 9893633d57
commit 61609b54e2
5 changed files with 18 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.31 2000/03/03 12:50:19 soda Exp $ */
/* $NetBSD: machdep.c,v 1.32 2000/03/25 10:14:13 nisimura Exp $ */
/* $OpenBSD: machdep.c,v 1.36 1999/05/22 21:22:19 weingart Exp $ */
/*
@ -519,8 +519,9 @@ mach_init(argc, argv, envv)
*/
proc0.p_addr = proc0paddr = (struct user *)kernend;
proc0.p_md.md_regs = (struct frame *)(kernend + USPACE) - 1;
curpcb = &proc0.p_addr->u_pcb;
memset(proc0.p_addr, 0, USPACE);
curpcb = &proc0.p_addr->u_pcb;
curpcb->pcb_context[11] = MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
kernend += USPACE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.3 2000/03/21 02:27:50 soren Exp $ */
/* $NetBSD: machdep.c,v 1.4 2000/03/25 10:14:13 nisimura Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang. All rights reserved.
@ -257,8 +257,9 @@ mach_init(void)
p0 = (caddr_t)pmap_steal_memory(USPACE, NULL, NULL);
proc0.p_addr = proc0paddr = (struct user *)p0;
proc0.p_md.md_regs = (struct frame *)((caddr_t)p0 + USPACE) - 1;
curpcb = &proc0.p_addr->u_pcb;
memset(p0, 0, USPACE);
curpcb = &proc0.p_addr->u_pcb;
curpcb->pcb_context[11] = MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
/*
* Allocate space for system data structures. These data structures

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.19 2000/02/21 13:46:02 shin Exp $ */
/* $NetBSD: machdep.c,v 1.20 2000/03/25 10:14:14 nisimura Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -43,7 +43,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.19 2000/02/21 13:46:02 shin Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.20 2000/03/25 10:14:14 nisimura Exp $");
/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
#include "opt_vr41x1.h"
@ -370,8 +370,9 @@ mach_init(argc, argv, bi)
proc0.p_addr = proc0paddr = (struct user *)kernend;
proc0.p_md.md_regs =
(struct frame *)((caddr_t)kernend + UPAGES * PAGE_SIZE) - 1;
curpcb = &proc0.p_addr->u_pcb;
memset(kernend, 0, UPAGES * PAGE_SIZE);
curpcb = &proc0.p_addr->u_pcb;
curpcb->pcb_context[11] = MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
kernend += UPAGES * PAGE_SIZE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.38 2000/03/03 08:36:21 nisimura Exp $ */
/* $NetBSD: machdep.c,v 1.39 2000/03/25 10:14:14 nisimura Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -43,7 +43,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.38 2000/03/03 08:36:21 nisimura Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.39 2000/03/25 10:14:14 nisimura Exp $");
/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
@ -305,8 +305,9 @@ mach_init(x_boothowto, x_bootdev, x_bootname, x_maxmem)
*/
proc0.p_addr = proc0paddr = (struct user *)kernend;
proc0.p_md.md_regs = (struct frame *)(kernend + USPACE) - 1;
curpcb = &proc0.p_addr->u_pcb;
memset(proc0.p_addr, 0, USPACE);
curpcb = &proc0.p_addr->u_pcb;
curpcb->pcb_context[11] = MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
kernend += USPACE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.167 2000/03/06 03:13:36 mhitch Exp $ */
/* $NetBSD: machdep.c,v 1.168 2000/03/25 10:14:14 nisimura Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.167 2000/03/06 03:13:36 mhitch Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.168 2000/03/25 10:14:14 nisimura Exp $");
#include "fs_mfs.h"
#include "opt_ddb.h"
@ -301,8 +301,9 @@ mach_init(argc, argv, code, cv, bim, bip)
*/
proc0.p_addr = proc0paddr = (struct user *)kernend;
proc0.p_md.md_regs = (struct frame *)(kernend + USPACE) - 1;
curpcb = &proc0.p_addr->u_pcb;
memset(proc0.p_addr, 0, USPACE);
curpcb = &proc0.p_addr->u_pcb;
curpcb->pcb_context[11] = MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
kernend += USPACE;