Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/usermode/dev call hardclock from a softint instead ...
details: https://anonhg.NetBSD.org/src/rev/a1fde456d308
branches: trunk
changeset: 768657:a1fde456d308
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Tue Aug 23 21:56:02 2011 +0000
description:
call hardclock from a softint instead of signal handler
diffstat:
sys/arch/usermode/dev/clock.c | 33 +++++++++++++++++++++++----------
1 files changed, 23 insertions(+), 10 deletions(-)
diffs (91 lines):
diff -r ac1bf2bf31a3 -r a1fde456d308 sys/arch/usermode/dev/clock.c
--- a/sys/arch/usermode/dev/clock.c Tue Aug 23 21:55:21 2011 +0000
+++ b/sys/arch/usermode/dev/clock.c Tue Aug 23 21:56:02 2011 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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,16 +118,21 @@
}
static void
-clock_intr(int notused)
+clock_signal(int notused)
{
- extern int usermode_x;
+ curcpu()->ci_idepth++;
+
+ softint_schedule(clock_sc->sc_ih);
+
+ curcpu()->ci_idepth--;
+}
+
+static void
+clock_softint(void *priv)
+{
struct clockframe cf;
- curcpu()->ci_idepth++;
-
hardclock(&cf);
-
- curcpu()->ci_idepth--;
}
static unsigned int
Home |
Main Index |
Thread Index |
Old Index