From 1130c186b568d5ce3a450c9906880f782e8e055d Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 9 Jan 2007 00:49:03 +0000 Subject: [PATCH] Use our interrupt infrastructure to handle the clock interrupt, but for the moment we have no common 'hard interrupt' (i.e. signal) core so do the critical section check manually. --- sys/platform/vkernel/platform/machintr.c | 11 +++++++++-- sys/platform/vkernel/platform/systimer.c | 31 +++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/sys/platform/vkernel/platform/machintr.c b/sys/platform/vkernel/platform/machintr.c index 7d2a3f084d..b25fe4c672 100644 --- a/sys/platform/vkernel/platform/machintr.c +++ b/sys/platform/vkernel/platform/machintr.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/platform/vkernel/platform/machintr.c,v 1.5 2007/01/08 03:33:43 dillon Exp $ + * $DragonFly: src/sys/platform/vkernel/platform/machintr.c,v 1.6 2007/01/09 00:49:03 dillon Exp $ */ #include @@ -111,7 +111,14 @@ splz(void) atomic_clear_int_nonlocked(&gd->mi.gd_reqflags, RQF_INTPEND); while ((irq = ffs(gd->gd_spending)) != 0) { - irq = irq - 1 + FIRST_SOFTINT; + --irq; + atomic_clear_int(&gd->gd_spending, 1 << irq); + irq += FIRST_SOFTINT; + sched_ithd(irq); + } + while ((irq = ffs(gd->gd_fpending)) != 0) { + --irq; + atomic_clear_int(&gd->gd_fpending, 1 << irq); sched_ithd(irq); } } diff --git a/sys/platform/vkernel/platform/systimer.c b/sys/platform/vkernel/platform/systimer.c index 92a7d26984..ead146c6d6 100644 --- a/sys/platform/vkernel/platform/systimer.c +++ b/sys/platform/vkernel/platform/systimer.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/platform/vkernel/platform/systimer.c,v 1.3 2007/01/07 02:42:24 dillon Exp $ + * $DragonFly: src/sys/platform/vkernel/platform/systimer.c,v 1.4 2007/01/09 00:49:03 dillon Exp $ */ #include @@ -40,8 +40,11 @@ #include #include #include +#include +#include #include #include +#include #include #include @@ -58,7 +61,8 @@ int wall_cmos_clock = 0; */ static sysclock_t vkernel_timer_get_timecount(void); static void vkernel_timer_construct(struct cputimer *timer, sysclock_t oclock); -static void cputimer_intr(int signo); +static void cputimer_intr_hard(int signo); +static void cputimer_intr(void *dummy, void *frame); static struct cputimer vkernel_cputimer = { SLIST_ENTRY_INITIALIZER, @@ -125,10 +129,12 @@ cputimer_intr_config(struct cputimer *timer) kprintf("cputimer_intr_config\n"); bzero(&sa, sizeof(sa)); - sa.sa_handler = cputimer_intr; + sa.sa_handler = cputimer_intr_hard; sigemptyset(&sa.sa_mask); sigaddset(&sa.sa_mask, SIGIO); sigaction(SIGALRM, &sa, NULL); + register_int(0, cputimer_intr, NULL, "timer", + NULL, INTR_FAST|INTR_MPSAFE); } /* @@ -156,7 +162,24 @@ cputimer_intr_reload(sysclock_t reload) */ static void -cputimer_intr(int signo) +cputimer_intr_hard(int signo) +{ + struct mdglobaldata *gd = mdcpu; + + /* + * XXX check critical section hack + */ + if (curthread->td_pri >= TDPRI_CRIT) { + atomic_set_int(&gd->gd_fpending, 1); + atomic_set_int(&gd->mi.gd_reqflags, RQF_INTPEND); + } else { + cputimer_intr(NULL, NULL); + } +} + +static +void +cputimer_intr(void *dummy, void *frame) { static sysclock_t sysclock_count; struct globaldata *gd = mycpu; -- 2.11.4.GIT