Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sh5 Some tidying up, and a fix for an event counter...



details:   https://anonhg.NetBSD.org/src/rev/3d534078629e
branches:  trunk
changeset: 536112:3d534078629e
user:      scw <scw%NetBSD.org@localhost>
date:      Sat Sep 07 20:43:32 2002 +0000

description:
Some tidying up, and a fix for an event counter array overrun
which was responsible for corrupting the kernel IPT.

diffstat:

 sys/arch/sh5/dev/intc.c      |   4 ++--
 sys/arch/sh5/include/intr.h  |   4 ++--
 sys/arch/sh5/sh5/interrupt.c |  13 +++++++------
 3 files changed, 11 insertions(+), 10 deletions(-)

diffs (91 lines):

diff -r 069bb12fb114 -r 3d534078629e sys/arch/sh5/dev/intc.c
--- a/sys/arch/sh5/dev/intc.c   Sat Sep 07 18:51:05 2002 +0000
+++ b/sys/arch/sh5/dev/intc.c   Sat Sep 07 20:43:32 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intc.c,v 1.3 2002/08/30 10:41:24 scw Exp $     */
+/*     $NetBSD: intc.c,v 1.4 2002/09/07 20:43:32 scw Exp $     */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -174,7 +174,7 @@
        int s;
 
        KDASSERT(trigger == IST_LEVEL);
-       KDASSERT(level <= 15 && level > 0);
+       KDASSERT(level > 0 && level < NIPL);
 
        intevt >>= 5;
 
diff -r 069bb12fb114 -r 3d534078629e sys/arch/sh5/include/intr.h
--- a/sys/arch/sh5/include/intr.h       Sat Sep 07 18:51:05 2002 +0000
+++ b/sys/arch/sh5/include/intr.h       Sat Sep 07 20:43:32 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intr.h,v 1.1 2002/07/05 13:32:00 scw Exp $     */
+/*     $NetBSD: intr.h,v 1.2 2002/09/07 20:43:33 scw Exp $     */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -45,7 +45,7 @@
 #define        IST_LEVEL       3       /* level-triggered */
 
 /* Interrupt priority levels */
-#define        NIPL            15
+#define        NIPL            16
 #define        _IPL_NSOFT      4
 
 #define        IPL_NONE        0       /* nothing */
diff -r 069bb12fb114 -r 3d534078629e sys/arch/sh5/sh5/interrupt.c
--- a/sys/arch/sh5/sh5/interrupt.c      Sat Sep 07 18:51:05 2002 +0000
+++ b/sys/arch/sh5/sh5/interrupt.c      Sat Sep 07 20:43:32 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: interrupt.c,v 1.2 2002/08/26 10:26:28 scw Exp $        */
+/*     $NetBSD: interrupt.c,v 1.3 2002/09/07 20:43:32 scw Exp $        */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -107,10 +107,11 @@
 
 struct evcnt _sh5_intr_events[NIPL];
 static char *intr_names[NIPL] = {
+       "none",
        "softmisc", "softclock", "softnet", "softserial",
        "irq5", "irq6", "irq7", "irq8",
        "irq9", "irq10", "irq11", "irq12",
-       "irq13", "irq14", "irq15"
+       "irq13", "clock", "irq15"
 };
 
 void sh5_intr_dispatch(struct intrframe *);
@@ -161,11 +162,12 @@
        struct intrhand *ih;
 
        KDASSERT(szintrhand != 0);
+       KDASSERT(level > 0 && level < NIPL);
 
        ih = alloc_ih();
        ih->ih_func = ih_func;
        ih->ih_arg = ih_arg;
-       ih->ih_level = level << SH5_CONREG_SR_IMASK_SHIFT;
+       ih->ih_level = level;
        ih->ih_intevt = intevt;
        ih->ih_type = trigger;
 
@@ -195,7 +197,7 @@
 {
        struct intrhand *ih = cookie;
 
-       return (&_sh5_intr_events[ih->ih_level - 1]);
+       return (&_sh5_intr_events[ih->ih_level]);
 }
 
 void
@@ -209,8 +211,7 @@
 
        KDASSERT(ih->ih_func != NULL);
 
-       if (ih->ih_level)
-               _sh5_intr_events[ih->ih_level - 1].ev_count++;
+       _sh5_intr_events[ih->ih_level].ev_count++;
 
        if ((ih->ih_func)(ih->ih_arg ? ih->ih_arg : (void *)fr))
                return;



Home | Main Index | Thread Index | Old Index