From 11404682053a44d205aea7911f2f39e67f2e533f Mon Sep 17 00:00:00 2001 From: thorpej Date: Wed, 24 May 2000 16:48:33 +0000 Subject: [PATCH] Use preempt(), not an open-coded equivalent (which won't be equivalent for long). --- 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(-) diff --git a/sys/arch/alpha/alpha/trap.c b/sys/arch/alpha/alpha/trap.c index a56d7d7db71b..77970f9f5a23 100644 --- a/sys/arch/alpha/alpha/trap.c +++ b/sys/arch/alpha/alpha/trap.c @@ -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 /* 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 #include @@ -182,7 +182,7 @@ userret(p, pc, oticks) 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 @@ userret(p, pc, oticks) 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 --git a/sys/arch/amiga/amiga/trap.c b/sys/arch/amiga/amiga/trap.c index 8f8fcce3ed5a..997ef2d23135 100644 --- a/sys/arch/amiga/amiga/trap.c +++ b/sys/arch/amiga/amiga/trap.c @@ -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 @@ userret(p, pc, oticks) int pc; u_quad_t oticks; { - int sig, s; + int sig; while ((sig = CURSIG(p)) != 0) postsig(sig); @@ -227,18 +227,9 @@ userret(p, pc, oticks) 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 --git a/sys/arch/arm32/arm32/ast.c b/sys/arch/arm32/arm32/ast.c index c61c02f6cdb7..d7a14326cefc 100644 --- a/sys/arch/arm32/arm32/ast.c +++ b/sys/arch/arm32/arm32/ast.c @@ -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 @@ userret(p, pc, oticks) int pc; u_quad_t oticks; { - int sig, s; + int sig; #ifdef DIAGNOSTIC if (p == NULL) @@ -99,21 +99,9 @@ userret(p, pc, oticks) 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 --git a/sys/arch/arm32/arm32/undefined.c b/sys/arch/arm32/arm32/undefined.c index 3463c08cecec..9cb3fe1499ca 100644 --- a/sys/arch/arm32/arm32/undefined.c +++ b/sys/arch/arm32/arm32/undefined.c @@ -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 @@ undefinedinstruction(frame) 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 @@ undefinedinstruction(frame) /* Fault has not been handled */ #ifdef VERBOSE_ARM32 - s = spltty(); + { s = spltty(); if ((fault_instruction & 0x0f000010) == 0x0e000000) { printf("CDP\n"); @@ -214,7 +213,7 @@ undefinedinstruction(frame) disassemble(fault_pc); } - (void)splx(s); + (void)splx(s); } #endif if ((fault_code & FAULT_USER) == 0) { @@ -250,21 +249,9 @@ undefinedinstruction(frame) 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 --git a/sys/arch/arm32/fpe-arm/armfpe_init.c b/sys/arch/arm32/fpe-arm/armfpe_init.c index 11e831df9553..d12987ccbb35 100644 --- a/sys/arch/arm32/fpe-arm/armfpe_init.c +++ b/sys/arch/arm32/fpe-arm/armfpe_init.c @@ -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 @@ arm_fpe_postproc(fpframe, frame) u_int fpframe; struct trapframe *frame; { - register u_int s; register int sig; register struct proc *p; @@ -195,22 +194,10 @@ arm_fpe_postproc(fpframe, frame) 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 --git a/sys/arch/atari/atari/trap.c b/sys/arch/atari/atari/trap.c index d54c7dd0e39c..c47ef30f429f 100644 --- a/sys/arch/atari/atari/trap.c +++ b/sys/arch/atari/atari/trap.c @@ -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 @@ userret(p, fp, oticks, faultaddr, fromtrap) u_int faultaddr; int fromtrap; { - int sig, s; + int sig; #ifdef M68040 int beenhere = 0; @@ -215,18 +215,9 @@ again: 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 --git a/sys/arch/hp300/hp300/trap.c b/sys/arch/hp300/hp300/trap.c index 93a10c06c127..5d7da87358ee 100644 --- a/sys/arch/hp300/hp300/trap.c +++ b/sys/arch/hp300/hp300/trap.c @@ -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 @@ userret(p, fp, oticks, faultaddr, fromtrap) u_int faultaddr; int fromtrap; { - int sig, s; + int sig; #ifdef M68040 int beenhere = 0; @@ -215,18 +215,9 @@ again: 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 --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c index f1723683a64d..e1169e68a022 100644 --- a/sys/arch/i386/i386/trap.c +++ b/sys/arch/i386/i386/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.135 2000/05/11 16:38:12 jdolecek Exp $ */ +/* $NetBSD: trap.c,v 1.136 2000/05/24 16:48:36 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -179,7 +179,7 @@ userret(p, pc, oticks) int pc; u_quad_t oticks; { - int sig, s; + int sig; /* take pending signals */ while ((sig = CURSIG(p)) != 0) @@ -187,18 +187,9 @@ userret(p, pc, oticks) 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); while ((sig = CURSIG(p)) != 0) postsig(sig); } diff --git a/sys/arch/luna68k/luna68k/trap.c b/sys/arch/luna68k/luna68k/trap.c index 222ac4410925..3e9e67d9fceb 100644 --- a/sys/arch/luna68k/luna68k/trap.c +++ b/sys/arch/luna68k/luna68k/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.3 2000/01/11 08:24:14 nisimura Exp $ */ +/* $NetBSD: trap.c,v 1.4 2000/05/24 16:48:37 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -44,7 +44,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.3 2000/01/11 08:24:14 nisimura Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.4 2000/05/24 16:48:37 thorpej Exp $"); #include "opt_ddb.h" #include "opt_execfmt.h" @@ -161,7 +161,7 @@ userret(p, fp, oticks, faultaddr, fromtrap) u_int faultaddr; int fromtrap; { - int sig, s; + int sig; #ifdef M68040 int beenhere = 0; @@ -173,18 +173,9 @@ again: 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 --git a/sys/arch/mac68k/mac68k/trap.c b/sys/arch/mac68k/mac68k/trap.c index 8a643f3d6fcf..3f6229361353 100644 --- a/sys/arch/mac68k/mac68k/trap.c +++ b/sys/arch/mac68k/mac68k/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.78 1999/12/12 08:18:49 scottr Exp $ */ +/* $NetBSD: trap.c,v 1.79 2000/05/24 16:48:37 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -184,7 +184,7 @@ userret(p, fp, oticks, faultaddr, fromtrap) u_int faultaddr; int fromtrap; { - int sig, s; + int sig; #if defined(M68040) int beenhere = 0; @@ -198,18 +198,9 @@ again: 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 --git a/sys/arch/mips/mips/trap.c b/sys/arch/mips/mips/trap.c index 3d8878f97519..c17169f1b160 100644 --- a/sys/arch/mips/mips/trap.c +++ b/sys/arch/mips/mips/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.129 2000/05/15 06:45:44 nisimura Exp $ */ +/* $NetBSD: trap.c,v 1.130 2000/05/24 16:48:39 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -44,7 +44,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.129 2000/05/15 06:45:44 nisimura Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.130 2000/05/24 16:48:39 thorpej Exp $"); #include "opt_cputype.h" /* which mips CPU levels do we support? */ #include "opt_inet.h" @@ -197,20 +197,10 @@ userret(p, pc, sticks) postsig(sig); p->p_priority = p->p_usrpri; if (want_resched) { - int s; /* - * 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); while ((sig = CURSIG(p)) != 0) postsig(sig); } diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c index 2bc67803fa9c..cd6cb84a22c4 100644 --- a/sys/arch/mvme68k/mvme68k/trap.c +++ b/sys/arch/mvme68k/mvme68k/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.36 2000/03/18 22:33:07 scw Exp $ */ +/* $NetBSD: trap.c,v 1.37 2000/05/24 16:48:40 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -207,7 +207,7 @@ userret(p, fp, oticks, faultaddr, fromtrap) u_int faultaddr; int fromtrap; { - int sig, s; + int sig; #ifdef M68040 int beenhere = 0; @@ -219,18 +219,9 @@ again: 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 --git a/sys/arch/news68k/news68k/trap.c b/sys/arch/news68k/news68k/trap.c index 84905b7c6a60..a1e1db5983fe 100644 --- a/sys/arch/news68k/news68k/trap.c +++ b/sys/arch/news68k/news68k/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.1 1999/12/09 14:53:18 tsutsui Exp $ */ +/* $NetBSD: trap.c,v 1.2 2000/05/24 16:48:41 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -193,7 +193,7 @@ userret(p, fp, oticks, faultaddr, fromtrap) u_int faultaddr; int fromtrap; { - int sig, s; + int sig; #ifdef M68040 int beenhere = 0; @@ -205,18 +205,9 @@ again: 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 --git a/sys/arch/next68k/next68k/trap.c b/sys/arch/next68k/next68k/trap.c index c07bcd102df5..873aa306047e 100644 --- a/sys/arch/next68k/next68k/trap.c +++ b/sys/arch/next68k/next68k/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.19 1999/12/05 11:56:33 ragge Exp $ */ +/* $NetBSD: trap.c,v 1.20 2000/05/24 16:48:41 thorpej Exp $ */ /* * This file was taken from mvme68k/mvme68k/trap.c @@ -214,7 +214,7 @@ userret(p, fp, oticks, faultaddr, fromtrap) u_int faultaddr; int fromtrap; { - int sig, s; + int sig; #ifdef M68040 int beenhere = 0; @@ -226,18 +226,9 @@ again: 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 --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c index 08d5e3a79045..456fa1e32cb8 100644 --- a/sys/arch/powerpc/powerpc/trap.c +++ b/sys/arch/powerpc/powerpc/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.23 2000/01/19 03:30:13 danw Exp $ */ +/* $NetBSD: trap.c,v 1.24 2000/05/24 16:48:41 thorpej Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -326,21 +326,11 @@ brain_damage: p->p_priority = p->p_usrpri; if (want_resched) { - int s, sig; - + int sig; /* - * 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 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)) postsig(sig); } diff --git a/sys/arch/sh3/sh3/trap.c b/sys/arch/sh3/sh3/trap.c index 2614248397e9..eadd1a925cac 100644 --- a/sys/arch/sh3/sh3/trap.c +++ b/sys/arch/sh3/sh3/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.9 2000/04/20 14:02:41 msaitoh Exp $ */ +/* $NetBSD: trap.c,v 1.10 2000/05/24 16:48:42 thorpej Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -99,7 +99,7 @@ userret(p, pc, oticks) int pc; u_quad_t oticks; { - int sig, s; + int sig; /* take pending signals */ while ((sig = CURSIG(p)) != 0) @@ -107,18 +107,9 @@ userret(p, pc, oticks) 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); while ((sig = CURSIG(p)) != 0) postsig(sig); } diff --git a/sys/arch/sparc/sparc/trap.c b/sys/arch/sparc/sparc/trap.c index 717514700185..ddadbd416b56 100644 --- a/sys/arch/sparc/sparc/trap.c +++ b/sys/arch/sparc/sparc/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.88 2000/02/08 03:16:00 mycroft Exp $ */ +/* $NetBSD: trap.c,v 1.89 2000/05/24 16:48:42 thorpej Exp $ */ /* * Copyright (c) 1996 @@ -228,18 +228,9 @@ userret(p, pc, oticks) } 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 switched, we might not be on the queue - * indicated by our priority. + * We are being preempted. */ - (void) splstatclock(); - setrunqueue(p); - p->p_stats->p_ru.ru_nivcsw++; - mi_switch(); - (void) spl0(); + preempt(NULL); while ((sig = CURSIG(p)) != 0) postsig(sig); } diff --git a/sys/arch/sparc64/sparc64/trap.c b/sys/arch/sparc64/sparc64/trap.c index a667329d6a37..0b6d1b3a75b4 100644 --- a/sys/arch/sparc64/sparc64/trap.c +++ b/sys/arch/sparc64/sparc64/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.38 2000/04/18 02:07:57 eeh Exp $ */ +/* $NetBSD: trap.c,v 1.39 2000/05/24 16:48:43 thorpej Exp $ */ /* * Copyright (c) 1996 @@ -437,18 +437,9 @@ userret(p, pc, oticks) } 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 switched, we might not be on the queue - * indicated by our priority. + * We are being preempted. */ - (void) splstatclock(); - setrunqueue(p); - p->p_stats->p_ru.ru_nivcsw++; - mi_switch(); - (void) spl0(); + preempt(NULL); while ((sig = CURSIG(p)) != 0) postsig(sig); } diff --git a/sys/arch/sun3/sun3/trap.c b/sys/arch/sun3/sun3/trap.c index 6b9c5af47c12..d617aba335e7 100644 --- a/sys/arch/sun3/sun3/trap.c +++ b/sys/arch/sun3/sun3/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.87 1999/12/05 11:56:36 ragge Exp $ */ +/* $NetBSD: trap.c,v 1.88 2000/05/24 16:48:43 thorpej Exp $ */ /* * Copyright (c) 1994 Gordon W. Ross @@ -188,7 +188,7 @@ userret(p, tf, oticks) register struct trapframe *tf; u_quad_t oticks; { - int sig, s; + int sig; /* take pending signals */ while ((sig = CURSIG(p)) != 0) @@ -198,18 +198,9 @@ userret(p, tf, oticks) 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 --git a/sys/arch/vax/vax/trap.c b/sys/arch/vax/vax/trap.c index abd1c3042f5a..986373aa401f 100644 --- a/sys/arch/vax/vax/trap.c +++ b/sys/arch/vax/vax/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.48 2000/03/19 14:56:54 ragge Exp $ */ +/* $NetBSD: trap.c,v 1.49 2000/05/24 16:48:44 thorpej Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -273,16 +273,9 @@ if(faultdebug)printf("trap accflt type %lx, code %lx, pc %lx, psl %lx\n", if (want_resched) { #endif /* - * 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 swtch()'ed, we might not be on the queue indicated by - * our priority. + * We are being preempted. */ - splstatclock(); - setrunqueue(p); - mi_switch(); + preempt(NULL); while ((sig = CURSIG(p)) != 0) postsig(sig); } @@ -403,16 +396,9 @@ bad: if (want_resched) { #endif /* - * 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 swtch()'ed, we might not be on the queue indicated by - * our priority. + * We are being preempted. */ - splstatclock(); - setrunqueue(p); - mi_switch(); + preempt(NULL); while ((sig = CURSIG(p)) != 0) postsig(sig); } diff --git a/sys/arch/x68k/x68k/trap.c b/sys/arch/x68k/x68k/trap.c index 2f31f9d260b8..0536c90b392f 100644 --- a/sys/arch/x68k/x68k/trap.c +++ b/sys/arch/x68k/x68k/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.37 2000/04/18 21:06:12 minoura Exp $ */ +/* $NetBSD: trap.c,v 1.38 2000/05/24 16:48:44 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -205,7 +205,7 @@ userret(p, fp, oticks, faultaddr, fromtrap) u_int faultaddr; int fromtrap; { - int sig, s; + int sig; #ifdef M68040 int beenhere = 0; @@ -217,18 +217,9 @@ again: 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); }