-/* $OpenBSD: macintr.c,v 1.56 2022/03/13 12:33:01 mpi Exp $ */
+/* $OpenBSD: macintr.c,v 1.57 2022/07/24 00:28:09 cheloha Exp $ */
/*-
* Copyright (c) 2008 Dale Rahn <drahn@openbsd.org>
intr = ppc_intr_disable();
macintr_setipl(newcpl);
+ if (ci->ci_dec_deferred && newcpl < IPL_CLOCK) {
+ ppc_mtdec(0);
+ ppc_mtdec(UINT32_MAX); /* raise DEC exception */
+ }
if ((newcpl < IPL_SOFTTTY && ci->ci_ipending & ppc_smask[newcpl])) {
s = splsofttty();
dosoftint(newcpl);
-/* $OpenBSD: openpic.c,v 1.89 2022/02/21 10:38:50 jsg Exp $ */
+/* $OpenBSD: openpic.c,v 1.90 2022/07/24 00:28:09 cheloha Exp $ */
/*-
* Copyright (c) 2008 Dale Rahn <drahn@openbsd.org>
intr = ppc_intr_disable();
openpic_setipl(newcpl);
+ if (ci->ci_dec_deferred && newcpl < IPL_CLOCK) {
+ ppc_mtdec(0);
+ ppc_mtdec(UINT32_MAX); /* raise DEC exception */
+ }
if (newcpl < IPL_SOFTTTY && (ci->ci_ipending & ppc_smask[newcpl])) {
s = splsofttty();
dosoftint(newcpl);
-/* $OpenBSD: clock.c,v 1.48 2021/02/23 04:44:30 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.49 2022/07/24 00:28:09 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */
/*
if (!ticks_per_intr)
return;
+ /*
+ * We can't actually mask DEC interrupts at or above IPL_CLOCK
+ * without masking other essential interrupts. To simulate
+ * masking, we retrigger the DEC by hand from splx(9) the next
+ * time our IPL drops below IPL_CLOCK.
+ */
+ if (ci->ci_cpl >= IPL_CLOCK) {
+ ci->ci_dec_deferred = 1;
+ ppc_mtdec(UINT32_MAX >> 1); /* clear DEC exception */
+ return;
+ }
+ ci->ci_dec_deferred = 0;
+
/*
* Based on the actual time delay since the last decrementer reload,
* we arrange for earlier interrupt next time.
*/
ppc_mtdec(nextevent - tb);
- if (ci->ci_cpl >= IPL_CLOCK) {
- ci->ci_statspending += nstats;
- } else {
- nstats += ci->ci_statspending;
- ci->ci_statspending = 0;
-
- s = splclock();
-
- /*
- * Reenable interrupts
- */
- ppc_intr_enable(1);
-
- /*
- * Do standard timer interrupt stuff.
- */
- while (ci->ci_lasttb < ci->ci_prevtb) {
- /* sync lasttb with hardclock */
- ci->ci_lasttb += ticks_per_intr;
- clk_count.ec_count++;
- hardclock(frame);
- }
+ nstats += ci->ci_statspending;
+ ci->ci_statspending = 0;
- while (nstats-- > 0)
- statclock(frame);
+ s = splclock();
- splx(s);
- (void) ppc_intr_disable();
+ /*
+ * Reenable interrupts
+ */
+ ppc_intr_enable(1);
- /* if a tick has occurred while dealing with these,
- * dont service it now, delay until the next tick.
- */
+ /*
+ * Do standard timer interrupt stuff.
+ */
+ while (ci->ci_lasttb < ci->ci_prevtb) {
+ /* sync lasttb with hardclock */
+ ci->ci_lasttb += ticks_per_intr;
+ clk_count.ec_count++;
+ hardclock(frame);
}
+
+ while (nstats-- > 0)
+ statclock(frame);
+
+ splx(s);
+ (void) ppc_intr_disable();
+
+ /* if a tick has occurred while dealing with these,
+ * dont service it now, delay until the next tick.
+ */
}
void cpu_startclock(void);
-/* $OpenBSD: cpu.h,v 1.71 2022/02/10 05:48:02 gkoehler Exp $ */
+/* $OpenBSD: cpu.h,v 1.72 2022/07/24 00:28:09 cheloha Exp $ */
/* $NetBSD: cpu.h,v 1.1 1996/09/30 16:34:21 ws Exp $ */
/*
volatile int ci_want_resched;
volatile int ci_cpl;
volatile int ci_ipending;
+ volatile int ci_dec_deferred;
volatile int ci_flags;
#define CI_FLAGS_SLEEPING 2
-/* $OpenBSD: intr.c,v 1.9 2015/09/13 14:06:40 kettenis Exp $ */
+/* $OpenBSD: intr.c,v 1.10 2022/07/24 00:28:09 cheloha Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom, Opsycon AB and RTMX Inc, USA.
ci->ci_cpl = newcpl;
+ if (ci->ci_dec_deferred && newcpl < IPL_CLOCK) {
+ ppc_mtdec(0);
+ ppc_mtdec(UINT32_MAX); /* raise DEC exception */
+ }
+
if (ci->ci_ipending & ppc_smask[newcpl])
dosoftint(newcpl);
}