Module Name: src
Committed By: jmcneill
Date: Tue Aug 23 21:56:02 UTC 2011
Modified Files:
src/sys/arch/usermode/dev: clock.c
Log Message:
call hardclock from a softint instead of signal handler
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/usermode/dev/clock.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/usermode/dev/clock.c
diff -u src/sys/arch/usermode/dev/clock.c:1.11 src/sys/arch/usermode/dev/clock.c:1.12
--- src/sys/arch/usermode/dev/clock.c:1.11 Tue Aug 23 17:00:36 2011
+++ src/sys/arch/usermode/dev/clock.c Tue Aug 23 21:56:02 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.11 2011/08/23 17:00:36 jmcneill Exp $ */
+/* $NetBSD: clock.c,v 1.12 2011/08/23 21:56:02 jmcneill Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <[email protected]>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.11 2011/08/23 17:00:36 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.12 2011/08/23 21:56:02 jmcneill Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -44,7 +44,8 @@
static int clock_match(device_t, cfdata_t, void *);
static void clock_attach(device_t, device_t, void *);
-static void clock_intr(int);
+static void clock_softint(void *);
+static void clock_signal(int);
static unsigned int clock_getcounter(struct timecounter *);
static int clock_todr_gettime(struct todr_chip_handle *, struct timeval *);
@@ -52,6 +53,7 @@
typedef struct clock_softc {
device_t sc_dev;
struct todr_chip_handle sc_todr;
+ void *sc_ih;
} clock_softc_t;
static struct timecounter clock_timecounter = {
@@ -65,6 +67,8 @@
NULL, /* next */
};
+static struct clock_softc *clock_sc;
+
CFATTACH_DECL_NEW(clock, sizeof(clock_softc_t),
clock_match, clock_attach, NULL, NULL);
@@ -89,12 +93,16 @@
aprint_naive("\n");
aprint_normal("\n");
+ KASSERT(clock_sc == NULL);
+ clock_sc = sc;
+
sc->sc_dev = self;
+ sc->sc_ih = softint_establish(SOFTINT_CLOCK, clock_softint, sc);
sc->sc_todr.todr_gettime = clock_todr_gettime;
todr_attach(&sc->sc_todr);
- (void)signal(SIGALRM, clock_intr);
+ thunk_signal(SIGALRM, clock_signal);
itimer.it_interval.tv_sec = 0;
itimer.it_interval.tv_usec = 10000;
@@ -110,18 +118,23 @@
}
static void
-clock_intr(int notused)
+clock_signal(int notused)
{
- extern int usermode_x;
- struct clockframe cf;
-
curcpu()->ci_idepth++;
- hardclock(&cf);
+ softint_schedule(clock_sc->sc_ih);
curcpu()->ci_idepth--;
}
+static void
+clock_softint(void *priv)
+{
+ struct clockframe cf;
+
+ hardclock(&cf);
+}
+
static unsigned int
clock_getcounter(struct timecounter *tc)
{