diff --git a/sys/alpha/alpha/interrupt.c b/sys/alpha/alpha/interrupt.c index 4f60ddf44f0f..c85e08d857bc 100644 --- a/sys/alpha/alpha/interrupt.c +++ b/sys/alpha/alpha/interrupt.c @@ -75,6 +75,7 @@ interrupt(a0, a1, a2, framep) struct trapframe *framep; { + atomic_add_int(&intr_nesting_level, 1); { struct proc* p = curproc; if (!p) p = &proc0; @@ -134,6 +135,7 @@ interrupt(a0, a1, a2, framep) a0, a1, a2); /* NOTREACHED */ } + atomic_subtract_int(&intr_nesting_level, 1); } void diff --git a/sys/alpha/alpha/ipl_funcs.c b/sys/alpha/alpha/ipl_funcs.c index ab8a83545e39..d13c47adb342 100644 --- a/sys/alpha/alpha/ipl_funcs.c +++ b/sys/alpha/alpha/ipl_funcs.c @@ -127,6 +127,7 @@ do_sir() u_int32_t pend; int i; + atomic_add_int(&intr_nesting_level, 1); splsoft(); while ((pend = atomic_readandclear(&ipending)) != 0) { for (i = 0; pend && i < 32; i++) { @@ -139,6 +140,7 @@ do_sir() } } } + atomic_subtract_int(&intr_nesting_level, 1); } #define GENSET(name, ptr, bit) \ diff --git a/sys/alpha/include/cpu.h b/sys/alpha/include/cpu.h index b9ff12de5b60..12436a15e2ba 100644 --- a/sys/alpha/include/cpu.h +++ b/sys/alpha/include/cpu.h @@ -65,11 +65,7 @@ struct clockframe { #define CLKF_BASEPRI(framep) \ (((framep)->cf_tf.tf_regs[FRAME_PS] & ALPHA_PSL_IPL_MASK) == 0) #define CLKF_PC(framep) ((framep)->cf_tf.tf_regs[FRAME_PC]) -/* - * XXX No way to accurately tell if we were in interrupt mode before taking - * clock interrupt. - */ -#define CLKF_INTR(framep) (0) +#define CLKF_INTR(framep) (intr_nesting_level >= 2) /* * Preempt the current process if in interrupt from user mode, @@ -96,6 +92,7 @@ struct clockframe { #ifdef KERNEL u_int32_t astpending; /* need to trap before returning to user mode */ +u_int32_t intr_nesting_level; /* bookeeping only; counts software intr */ u_int32_t want_resched; /* resched() was called */ #endif