Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amiga introduce an interrupt_depth variable which c...



details:   https://anonhg.NetBSD.org/src/rev/b58eae1e0d13
branches:  trunk
changeset: 517154:b58eae1e0d13
user:      aymeric <aymeric%NetBSD.org@localhost>
date:      Wed Nov 07 23:25:03 2001 +0000

description:
introduce an interrupt_depth variable which counts how nested we are into
interrupts.
This allows hardclock() to account for the time spent in interrrupts, and
as a side-effect, top(1), systat(1) and others will no more report 0% of
interrupt activity.

mvme68k does that already.

diffstat:

 sys/arch/amiga/amiga/locore.s  |  19 ++++++++++++++++++-
 sys/arch/amiga/amiga/machdep.c |   4 +++-
 sys/arch/amiga/include/cpu.h   |  11 +++--------
 3 files changed, 24 insertions(+), 10 deletions(-)

diffs (172 lines):

diff -r 8d68cb5e2161 -r b58eae1e0d13 sys/arch/amiga/amiga/locore.s
--- a/sys/arch/amiga/amiga/locore.s     Wed Nov 07 21:13:26 2001 +0000
+++ b/sys/arch/amiga/amiga/locore.s     Wed Nov 07 23:25:03 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.125 2001/07/22 13:34:02 wiz Exp $ */
+/*     $NetBSD: locore.s,v 1.126 2001/11/07 23:25:03 aymeric Exp $     */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -447,11 +447,14 @@
  */
 
 ENTRY_NOPROFILE(spurintr)
+       addql   #1,_C_LABEL(interrupt_depth)
        addql   #1,_C_LABEL(intrcnt)+0
        addql   #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
+       subql   #1,_C_LABEL(interrupt_depth)
        jra     _ASM_LABEL(rei)
 
 ENTRY_NOPROFILE(lev5intr)
+       addql   #1,_C_LABEL(interrupt_depth)
        moveml  %d0/%d1/%a0/%a1,%sp@-
 #include "ser.h"
 #if NSER > 0
@@ -463,10 +466,12 @@
        moveml  %sp@+,%d0/%d1/%a0/%a1
        addql   #1,_C_LABEL(intrcnt)+20
        addql   #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
+       subql   #1,_C_LABEL(interrupt_depth)
        jra     _ASM_LABEL(rei)
 
 #ifdef DRACO
 ENTRY_NOPROFILE(DraCoLev2intr)
+       addql   #1,_C_LABEL(interrupt_depth)
        moveml  %d0/%d1/%a0/%a1,%sp@-
 
        CIAAADDR(%a0)
@@ -490,10 +495,12 @@
 Ldraciaend:
        moveml  %sp@+,%d0/%d1/%a0/%a1
        addql   #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
+       subql   #1,_C_LABEL(interrupt_depth)
        jra     _ASM_LABEL(rei)
 
 /* XXX on the DraCo rev. 4 or later, lev 1 is vectored here. */
 ENTRY_NOPROFILE(DraCoLev1intr)
+       addql   #1,_C_LABEL(interrupt_depth)
        moveml  %d0/%d1/%a0/%a1,%sp@-
        movl    _C_LABEL(draco_ioct),%a0
        btst    #5,%a0@(7)
@@ -522,10 +529,12 @@
 
        moveml  %sp@+,%d0/%d1/%a0/%a1
        addql   #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
+       subql   #1,_C_LABEL(interrupt_depth)
        jra     _ASM_LABEL(rei) | XXXX: shouldn't we call the normal lev1?
 
 /* XXX on the DraCo, lev 1, 3, 4, 5 and 6 are vectored here by initcpu() */
 ENTRY_NOPROFILE(DraCoIntr)
+       addql   #1,_C_LABEL(interrupt_depth)
        moveml  %d0/%d1/%a0/%a1,%sp@-
 Ldrintrcommon:
        lea     _ASM_LABEL(Drintrcnt)-4,%a0
@@ -538,6 +547,7 @@
        addql   #4,%sp                  | pop SR
        moveml  %sp@+,%d0/%d1/%a0/%a1
        addql   #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
+       subql   #1,_C_LABEL(interrupt_depth)
        jra     _ASM_LABEL(rei)
 #endif
        
@@ -548,6 +558,7 @@
 #ifndef LEV6_DEFER
 ENTRY_NOPROFILE(lev4intr)
 #endif
+       addql   #1,_C_LABEL(interrupt_depth)
        moveml  %d0/%d1/%a0/%a1,%sp@-
 Lintrcommon:
        lea     _C_LABEL(intrcnt),%a0
@@ -560,6 +571,7 @@
        addql   #4,%sp                  | pop SR
        moveml  %sp@+,%d0/%d1/%a0/%a1
        addql   #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
+       subql   #1,_C_LABEL(interrupt_depth)
        jra     _ASM_LABEL(rei)
 
 /* XXX used to be ifndef DRACO; vector will be overwritten by initcpu() */
@@ -571,6 +583,7 @@
         * as we return. Block generation of level 6 ints until
         * we have dealt with this one.
         */
+       addql   #1,_C_LABEL(interrupt_depth)
        moveml  %d0/%a0,%sp@-
        INTREQRADDR(%a0)
        movew   %a0@,%d0
@@ -582,15 +595,18 @@
        movew   #INTF_EXTER,%a0@
        movew   #INTF_SETCLR+INTF_AUD3,%a0@     | make sure THIS one is ok...
        moveml  %sp@+,%d0/%a0
+       subql   #1,_C_LABEL(interrupt_depth)
        rte
 Llev6spur:
        addql   #1,_C_LABEL(intrcnt)+36 | count spurious level 6 interrupts
        moveml  %sp@+,%d0/%a0
+       subql   #1,_C_LABEL(interrupt_depth)
        rte
 
 ENTRY_NOPROFILE(lev4intr)
 ENTRY_NOPROFILE(fake_lev6intr)
 #endif
+       addql   #1,_C_LABEL(interrupt_depth)
        moveml  %d0/%d1/%a0/%a1,%sp@-
 #ifdef LEV6_DEFER
        /*
@@ -634,6 +650,7 @@
 Llev6done:
        moveml  %sp@+,%d0/%d1/%a0/%a1   | restore scratch regs
        addql   #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
+       subql   #1,_C_LABEL(interrupt_depth)
        jra     _ASM_LABEL(rei)         | all done [can we do rte here?]
 Lchkexter:
 | check to see if EXTER request is really set?
diff -r 8d68cb5e2161 -r b58eae1e0d13 sys/arch/amiga/amiga/machdep.c
--- a/sys/arch/amiga/amiga/machdep.c    Wed Nov 07 21:13:26 2001 +0000
+++ b/sys/arch/amiga/amiga/machdep.c    Wed Nov 07 23:25:03 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.164 2001/09/10 21:19:10 chris Exp $      */
+/*     $NetBSD: machdep.c,v 1.165 2001/11/07 23:25:03 aymeric Exp $    */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -122,6 +122,8 @@
 void fdintr __P((int));
 #endif
 
+volatile unsigned int interrupt_depth = 0;
+
 /*
  * patched by some devices at attach time (currently, only the coms)
  */
diff -r 8d68cb5e2161 -r b58eae1e0d13 sys/arch/amiga/include/cpu.h
--- a/sys/arch/amiga/include/cpu.h      Wed Nov 07 21:13:26 2001 +0000
+++ b/sys/arch/amiga/include/cpu.h      Wed Nov 07 23:25:03 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.52 2001/05/30 12:28:39 mrg Exp $     */
+/*     $NetBSD: cpu.h,v 1.53 2001/11/07 23:25:04 aymeric Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -81,6 +81,7 @@
 #define        cpu_swapout(p)                  /* nothing */
 #define        cpu_number()                    0
 
+extern volatile unsigned int interrupt_depth;
 /*
  * Arguments to hardclock and gatherstats encapsulate the previous
  * machine state in an opaque clockframe.  One the hp300, we use
@@ -96,13 +97,7 @@
 /*#define      CLKF_BASEPRI(framep)    (((framep)->sr & PSL_IPL) == 0)*/
 #define        CLKF_BASEPRI(framep)    (0)
 #define        CLKF_PC(framep)         ((framep)->pc)
-#if 0
-/* We would like to do it this way... */
-#define        CLKF_INTR(framep)       (((framep)->sr & PSL_M) == 0)
-#else
-/* but until we start using PSL_M, we have to do this instead */
-#define        CLKF_INTR(framep)       (0)     /* XXX */
-#endif
+#define        CLKF_INTR(framep)       (interrupt_depth > 1)
 
 
 /*



Home | Main Index | Thread Index | Old Index