summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2003-08-12 18:06:49 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2003-08-12 18:06:49 +0000
commitc28ec49afe3931f5c32ad4a619a9b240a19db1e9 (patch)
tree4a3db0efd955efba677a7712bb9c5e672887405a
parent60d62fa87f74eeb4964059445d406e4d38ad71c9 (diff)
The idle loop is supposed to run with interrupts enabled, and will only
relax the interrupt mask (i.e. spl level). However, under some unclear circumstances, it will be entered with interrupts disabled, and thus will loop forever if no process is runnable. Check the PSR and make sure that interrupts are enabled in this case. This gets rid of the random freezes, although a better fix would be preferrable...
-rw-r--r--sys/arch/mvme88k/mvme88k/process.S22
1 files changed, 20 insertions, 2 deletions
diff --git a/sys/arch/mvme88k/mvme88k/process.S b/sys/arch/mvme88k/mvme88k/process.S
index f3a63118c0c..ae81e62b9ab 100644
--- a/sys/arch/mvme88k/mvme88k/process.S
+++ b/sys/arch/mvme88k/mvme88k/process.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: process.S,v 1.19 2003/08/11 20:45:17 miod Exp $ */
+/* $OpenBSD: process.S,v 1.20 2003/08/12 18:06:48 miod Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* All rights reserved.
@@ -42,6 +42,11 @@ ASLOCAL(swchanpanic)
align 4
ASLOCAL(swsrunpanic)
string "switch SRUN %x\0"
+#ifdef DEBUG
+ align 4
+ASLOCAL(boguspsr)
+ string "Invalid PSR in idle loop 0x%x\n\0"
+#endif
text
align 8
@@ -143,9 +148,22 @@ ASLOCAL(Lidleloop)
bcnd ne0, r7, _ASM_LABEL(Ldoneloop)
ASLOCAL(Lloopchk) /* if whichqs is zero, keep checking */
- bsr.n _C_LABEL(setipl) /* enable all ints */
+ bsr.n _C_LABEL(setipl) /* unmask all ints... */
or r2, r0, 0
+ ldcr r2, PSR
+ bb0 PSR_INTERRUPT_DISABLE_BIT, r2, 1f
+#ifdef DEBUG
+ or r3, r2, r0
+ or.u r2, r0, hi16(_ASM_LABEL(boguspsr))
+ bsr.n _C_LABEL(printf)
+ or r2, r2, lo16(_ASM_LABEL(boguspsr))
+ ldcr r2, PSR
+#endif
+ clr r2, r2, 1<PSR_INTERRUPT_DISABLE_BIT> /* ...and enable them */
+ FLUSH_PIPELINE
+ stcr r2, PSR
+1:
br _ASM_LABEL(Lidleloop)
ASLOCAL(Ldoneloop)