Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Use preempt(), not an open-coded equivalent (which ...



details:   https://anonhg.NetBSD.org/src/rev/1d2d7fa6a5c9
branches:  trunk
changeset: 486525:1d2d7fa6a5c9
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed May 24 16:48:33 2000 +0000

description:
Use preempt(), not an open-coded equivalent (which won't be
equivalent for long).

diffstat:

 sys/arch/alpha/alpha/trap.c          |  19 +++++--------------
 sys/arch/amiga/amiga/trap.c          |  17 ++++-------------
 sys/arch/arm32/arm32/ast.c           |  20 ++++----------------
 sys/arch/arm32/arm32/undefined.c     |  23 +++++------------------
 sys/arch/arm32/fpe-arm/armfpe_init.c |  23 +++++------------------
 sys/arch/atari/atari/trap.c          |  17 ++++-------------
 sys/arch/hp300/hp300/trap.c          |  17 ++++-------------
 sys/arch/i386/i386/trap.c            |  17 ++++-------------
 sys/arch/luna68k/luna68k/trap.c      |  19 +++++--------------
 sys/arch/mac68k/mac68k/trap.c        |  17 ++++-------------
 sys/arch/mips/mips/trap.c            |  18 ++++--------------
 sys/arch/mvme68k/mvme68k/trap.c      |  17 ++++-------------
 sys/arch/news68k/news68k/trap.c      |  17 ++++-------------
 sys/arch/next68k/next68k/trap.c      |  17 ++++-------------
 sys/arch/powerpc/powerpc/trap.c      |  18 ++++--------------
 sys/arch/sh3/sh3/trap.c              |  17 ++++-------------
 sys/arch/sparc/sparc/trap.c          |  15 +++------------
 sys/arch/sparc64/sparc64/trap.c      |  15 +++------------
 sys/arch/sun3/sun3/trap.c            |  17 ++++-------------
 sys/arch/vax/vax/trap.c              |  24 +++++-------------------
 sys/arch/x68k/x68k/trap.c            |  17 ++++-------------
 21 files changed, 87 insertions(+), 294 deletions(-)

diffs (truncated from 852 to 300 lines):

diff -r 6a3eea20f2db -r 1d2d7fa6a5c9 sys/arch/alpha/alpha/trap.c
--- a/sys/arch/alpha/alpha/trap.c       Wed May 24 14:43:00 2000 +0000
+++ b/sys/arch/alpha/alpha/trap.c       Wed May 24 16:48:33 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.51 2000/03/01 02:22:03 thorpej Exp $ */
+/* $NetBSD: trap.c,v 1.52 2000/05/24 16:48:33 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.51 2000/03/01 02:22:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.52 2000/05/24 16:48:33 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -182,7 +182,7 @@
        u_int64_t pc;
        u_quad_t oticks;
 {
-       int sig, s;
+       int sig;
 
        /* Do any deferred user pmap operations. */
        PMAP_USERRET(vm_map_pmap(&p->p_vmspace->vm_map));
@@ -193,18 +193,9 @@
        p->p_priority = p->p_usrpri;
        if (want_resched) {
                /*
-                * Since we are curproc, a clock interrupt could
-                * change our priority without changing run queues
-                * (the running process is not kept on a run queue).
-                * If this happened after we setrunqueue ourselves but
-                * before we switch()'ed, we might not be on the queue
-                * indicated by our priority.
+                * We are being preempted.
                 */
-               s = splstatclock();
-               setrunqueue(p);
-               p->p_stats->p_ru.ru_nivcsw++;
-               mi_switch();
-               splx(s);
+               preempt(NULL);
                PMAP_USERRET(vm_map_pmap(&p->p_vmspace->vm_map));
                while ((sig = CURSIG(p)) != 0)
                        postsig(sig);
diff -r 6a3eea20f2db -r 1d2d7fa6a5c9 sys/arch/amiga/amiga/trap.c
--- a/sys/arch/amiga/amiga/trap.c       Wed May 24 14:43:00 2000 +0000
+++ b/sys/arch/amiga/amiga/trap.c       Wed May 24 16:48:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.72 1999/12/05 11:56:30 ragge Exp $  */
+/*     $NetBSD: trap.c,v 1.73 2000/05/24 16:48:34 thorpej Exp $        */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -218,7 +218,7 @@
        int pc;
        u_quad_t oticks;
 {
-       int sig, s;
+       int sig;
 
        while ((sig = CURSIG(p)) != 0)
                postsig(sig);
@@ -227,18 +227,9 @@
 
        if (want_resched) {
                /*
-                * Since we are curproc, clock will normally just change
-                * our priority without moving us from one queue to another
-                * (since the running process is not on a queue.)
-                * If that happened after we setrunqueue ourselves but before
-                * we switch'ed, we might not be on the queue indicated by
-                * our priority.
+                * We are being preempted.
                 */
-               s = splstatclock();
-               setrunqueue(p);
-               p->p_stats->p_ru.ru_nivcsw++;
-               mi_switch();
-               splx(s);
+               preempt(NULL);
                while ((sig = CURSIG(p)) != 0)
                        postsig(sig);
        }
diff -r 6a3eea20f2db -r 1d2d7fa6a5c9 sys/arch/arm32/arm32/ast.c
--- a/sys/arch/arm32/arm32/ast.c        Wed May 24 14:43:00 2000 +0000
+++ b/sys/arch/arm32/arm32/ast.c        Wed May 24 16:48:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ast.c,v 1.16 1999/03/24 05:50:53 mrg Exp $     */
+/*     $NetBSD: ast.c,v 1.17 2000/05/24 16:48:34 thorpej Exp $ */
 
 /*
  * Copyright (c) 1994,1995 Mark Brinicombe
@@ -68,7 +68,7 @@
        int pc;
        u_quad_t oticks;
 {
-       int sig, s;
+       int sig;
 
 #ifdef DIAGNOSTIC
        if (p == NULL)
@@ -99,21 +99,9 @@
 
        if (want_resched) {
                /*
-                * Since we are curproc, a clock interrupt could
-                * change our priority without changing run queues
-                * (the running process is not kept on a run queue).
-                * If this happened after we setrunqueue ourselves but
-                * before we switch()'ed, we might not be on the queue
-                * indicated by our priority
+                * We are being preempted.
                 */
-
-               s = splstatclock();
-               setrunqueue(p);
-               p->p_stats->p_ru.ru_nivcsw++;
-
-               mi_switch();
-
-               (void)splx(s);
+               preempt(NULL);
                while ((sig = (CURSIG(p))) != 0) {
                        postsig(sig);
                }
diff -r 6a3eea20f2db -r 1d2d7fa6a5c9 sys/arch/arm32/arm32/undefined.c
--- a/sys/arch/arm32/arm32/undefined.c  Wed May 24 14:43:00 2000 +0000
+++ b/sys/arch/arm32/arm32/undefined.c  Wed May 24 16:48:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: undefined.c,v 1.16 1999/03/30 10:10:57 mycroft Exp $   */
+/*     $NetBSD: undefined.c,v 1.17 2000/05/24 16:48:35 thorpej Exp $   */
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -127,7 +127,6 @@
        struct proc *p;
        u_int fault_pc;
        int fault_instruction;
-       int s;
        int fault_code;
        u_quad_t sticks = 0;
        int coprocessor;
@@ -194,7 +193,7 @@
                /* Fault has not been handled */
 
 #ifdef VERBOSE_ARM32
-               s = spltty();
+               { s = spltty();
 
                if ((fault_instruction & 0x0f000010) == 0x0e000000) {
                        printf("CDP\n");
@@ -214,7 +213,7 @@
                        disassemble(fault_pc);
                }
 
-               (void)splx(s);
+               (void)splx(s); }
 #endif
         
                if ((fault_code & FAULT_USER) == 0) {
@@ -250,21 +249,9 @@
 
                if (want_resched) {
                        /*
-                        * Since we are curproc, a clock interrupt could
-                        * change our priority without changing run queues
-                        * (the running process is not kept on a run queue).
-                        * If this happened after we setrunqueue ourselves but
-                        * before we switch()'ed, we might not be on the queue
-                        * indicated by our priority
+                        * We are being preempted.
                         */
-       
-                       s = splstatclock();
-                       setrunqueue(p);
-                       p->p_stats->p_ru.ru_nivcsw++;
-
-                       mi_switch();
-
-                       (void)splx(s);
+                       preempt(NULL);
                        while ((sig = (CURSIG(p))) != 0) {
                                postsig(sig);
                        }
diff -r 6a3eea20f2db -r 1d2d7fa6a5c9 sys/arch/arm32/fpe-arm/armfpe_init.c
--- a/sys/arch/arm32/fpe-arm/armfpe_init.c      Wed May 24 14:43:00 2000 +0000
+++ b/sys/arch/arm32/fpe-arm/armfpe_init.c      Wed May 24 16:48:33 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: armfpe_init.c,v 1.16 1998/05/01 15:35:43 mark Exp $ */
+/* $NetBSD: armfpe_init.c,v 1.17 2000/05/24 16:48:35 thorpej Exp $ */
 
 /*
  * Copyright (C) 1996 Mark Brinicombe
@@ -179,7 +179,6 @@
        u_int fpframe;
        struct trapframe *frame;
 {
-       register u_int s;
        register int sig;
        register struct proc *p;
 
@@ -195,22 +194,10 @@
        p->p_priority = p->p_usrpri;
 
        if (want_resched) {
-        /*
-         * Since we are curproc, a clock interrupt could
-         * change our priority without changing run queues
-         * (the running process is not kept on a run queue).
-         * If this happened after we setrunqueue ourselves but
-         * before we switch()'ed, we might not be on the queue
-         * indicated by our priority
-         */
-       
-               s = splstatclock();
-               setrunqueue(p);
-               p->p_stats->p_ru.ru_nivcsw++;
-
-               mi_switch();
-
-               (void)splx(s);
+               /*
+                * We are being preempted.
+                */
+               preempt(NULL);
                while ((sig = (CURSIG(p))) != 0) {
                        postsig(sig);
                }
diff -r 6a3eea20f2db -r 1d2d7fa6a5c9 sys/arch/atari/atari/trap.c
--- a/sys/arch/atari/atari/trap.c       Wed May 24 14:43:00 2000 +0000
+++ b/sys/arch/atari/atari/trap.c       Wed May 24 16:48:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.48 2000/03/30 13:28:28 leo Exp $    */
+/*     $NetBSD: trap.c,v 1.49 2000/05/24 16:48:35 thorpej Exp $        */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -203,7 +203,7 @@
        u_int faultaddr;
        int fromtrap;
 {
-       int sig, s;
+       int sig;
 #ifdef M68040
        int beenhere = 0;
 
@@ -215,18 +215,9 @@
        p->p_priority = p->p_usrpri;
        if (want_resched) {
                /*
-                * Since we are curproc, clock will normally just change
-                * our priority without moving us from one queue to another
-                * (since the running process is not on a queue.)
-                * If that happened after we put ourselves on the run queue
-                * but before we mi_switch()'ed, we might not be on the queue
-                * indicated by our priority.
+                * We are being preempted.
                 */
-               s = splstatclock();
-               setrunqueue(p);
-               p->p_stats->p_ru.ru_nivcsw++;
-               mi_switch();
-               splx(s);
+               preempt(NULL);
                while ((sig = CURSIG(p)) != 0)
                        postsig(sig);
        }
diff -r 6a3eea20f2db -r 1d2d7fa6a5c9 sys/arch/hp300/hp300/trap.c
--- a/sys/arch/hp300/hp300/trap.c       Wed May 24 14:43:00 2000 +0000
+++ b/sys/arch/hp300/hp300/trap.c       Wed May 24 16:48:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.75 1999/12/05 11:56:32 ragge Exp $  */
+/*     $NetBSD: trap.c,v 1.76 2000/05/24 16:48:36 thorpej Exp $        */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -203,7 +203,7 @@
        u_int faultaddr;
        int fromtrap;
 {
-       int sig, s;
+       int sig;
 #ifdef M68040
        int beenhere = 0;
 
@@ -215,18 +215,9 @@
        p->p_priority = p->p_usrpri;
        if (want_resched) {
                /*
-                * Since we are curproc, clock will normally just change
-                * our priority without moving us from one queue to another
-                * (since the running process is not on a queue.)
-                * If that happened after we put ourselves on the run queue
-                * but before we mi_switch()'ed, we might not be on the queue
-                * indicated by our priority.
+                * We are being preempted.



Home | Main Index | Thread Index | Old Index