Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Make sure proc0 PCB has spl0 condition in CP0 statu...



details:   https://anonhg.NetBSD.org/src/rev/b423df0f0b81
branches:  trunk
changeset: 484091:b423df0f0b81
user:      nisimura <nisimura%NetBSD.org@localhost>
date:      Sat Mar 25 10:14:13 2000 +0000

description:
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@localhost>.

diffstat:

 sys/arch/arc/arc/machdep.c           |  5 +++--
 sys/arch/cobalt/cobalt/machdep.c     |  5 +++--
 sys/arch/hpcmips/hpcmips/machdep.c   |  7 ++++---
 sys/arch/newsmips/newsmips/machdep.c |  7 ++++---
 sys/arch/pmax/pmax/machdep.c         |  7 ++++---
 5 files changed, 18 insertions(+), 13 deletions(-)

diffs (127 lines):

diff -r e4a8621118f2 -r b423df0f0b81 sys/arch/arc/arc/machdep.c
--- a/sys/arch/arc/arc/machdep.c        Sat Mar 25 07:23:12 2000 +0000
+++ b/sys/arch/arc/arc/machdep.c        Sat Mar 25 10:14:13 2000 +0000
@@ -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 @@
         */
        proc0.p_addr = proc0paddr = (struct user *)kernend;
        proc0.p_md.md_regs = (struct frame *)(kernend + USPACE) - 1;
+       memset(proc0.p_addr, 0, USPACE);
        curpcb = &proc0.p_addr->u_pcb;
-       memset(proc0.p_addr, 0, USPACE);
+       curpcb->pcb_context[11] = MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
 
        kernend += USPACE;
 
diff -r e4a8621118f2 -r b423df0f0b81 sys/arch/cobalt/cobalt/machdep.c
--- a/sys/arch/cobalt/cobalt/machdep.c  Sat Mar 25 07:23:12 2000 +0000
+++ b/sys/arch/cobalt/cobalt/machdep.c  Sat Mar 25 10:14:13 2000 +0000
@@ -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 @@
        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;
+       memset(p0, 0, USPACE);
        curpcb = &proc0.p_addr->u_pcb;
-       memset(p0, 0, USPACE);
+       curpcb->pcb_context[11] = MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
 
        /*
         * Allocate space for system data structures.  These data structures
diff -r e4a8621118f2 -r b423df0f0b81 sys/arch/hpcmips/hpcmips/machdep.c
--- a/sys/arch/hpcmips/hpcmips/machdep.c        Sat Mar 25 07:23:12 2000 +0000
+++ b/sys/arch/hpcmips/hpcmips/machdep.c        Sat Mar 25 10:14:13 2000 +0000
@@ -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 @@
        proc0.p_addr = proc0paddr = (struct user *)kernend;
        proc0.p_md.md_regs =
            (struct frame *)((caddr_t)kernend + UPAGES * PAGE_SIZE) - 1;
+       memset(kernend, 0, UPAGES * PAGE_SIZE);
        curpcb = &proc0.p_addr->u_pcb;
-       memset(kernend, 0, UPAGES * PAGE_SIZE);
+       curpcb->pcb_context[11] = MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
 
        kernend += UPAGES * PAGE_SIZE;
 
diff -r e4a8621118f2 -r b423df0f0b81 sys/arch/newsmips/newsmips/machdep.c
--- a/sys/arch/newsmips/newsmips/machdep.c      Sat Mar 25 07:23:12 2000 +0000
+++ b/sys/arch/newsmips/newsmips/machdep.c      Sat Mar 25 10:14:13 2000 +0000
@@ -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 @@
         */
        proc0.p_addr = proc0paddr = (struct user *)kernend;
        proc0.p_md.md_regs = (struct frame *)(kernend + USPACE) - 1;
+       memset(proc0.p_addr, 0, USPACE);
        curpcb = &proc0.p_addr->u_pcb;
-       memset(proc0.p_addr, 0, USPACE);
+       curpcb->pcb_context[11] = MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
 
        kernend += USPACE;
 
diff -r e4a8621118f2 -r b423df0f0b81 sys/arch/pmax/pmax/machdep.c
--- a/sys/arch/pmax/pmax/machdep.c      Sat Mar 25 07:23:12 2000 +0000
+++ b/sys/arch/pmax/pmax/machdep.c      Sat Mar 25 10:14:13 2000 +0000
@@ -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 @@
         */
        proc0.p_addr = proc0paddr = (struct user *)kernend;
        proc0.p_md.md_regs = (struct frame *)(kernend + USPACE) - 1;
+       memset(proc0.p_addr, 0, USPACE);
        curpcb = &proc0.p_addr->u_pcb;
-       memset(proc0.p_addr, 0, USPACE);
+       curpcb->pcb_context[11] = MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
 
        kernend += USPACE;
 



Home | Main Index | Thread Index | Old Index