diff options
-rw-r--r-- | sys/i386/i386/machdep.c | 2 | ||||
-rw-r--r-- | sys/i386/isa/clock.c | 20 | ||||
-rw-r--r-- | sys/isa/atrtc.c | 20 |
3 files changed, 37 insertions, 5 deletions
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index b80ec10..675eb26 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -1982,7 +1982,7 @@ init386(first) * under witness. */ mutex_init(); - mtx_init(&clock_lock, "clk", NULL, MTX_SPIN | MTX_RECURSE); + mtx_init(&clock_lock, "clk", NULL, MTX_SPIN); mtx_init(&icu_lock, "icu", NULL, MTX_SPIN | MTX_NOWITNESS); /* make ldt memory segments */ diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c index 3d7d8c1..29cfefc 100644 --- a/sys/i386/isa/clock.c +++ b/sys/i386/isa/clock.c @@ -322,8 +322,18 @@ DELAY(int n) * takes about 1.5 usec for each of the i/o's in getit(). The loop * takes about 6 usec on a 486/33 and 13 usec on a 386/20. The * multiplications and divisions to scale the count take a while). + * + * However, if ddb is active then use a fake counter since reading + * the i8254 counter involves acquiring a lock. ddb must not go + * locking for many reasons, but it calls here for at least atkbd + * input. */ - prev_tick = getit(); +#ifdef DDB + if (db_active) + prev_tick = 0; + else +#endif + prev_tick = getit(); n -= 0; /* XXX actually guess no initial overhead */ /* * Calculate (n * (timer_freq / 1e6)) without using floating point @@ -350,7 +360,13 @@ DELAY(int n) / 1000000; while (ticks_left > 0) { - tick = getit(); +#ifdef DDB + if (db_active) { + inb(0x84); + tick = prev_tick + 1; + } else +#endif + tick = getit(); #ifdef DELAYDEBUG ++getit_calls; #endif diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c index 3d7d8c1..29cfefc 100644 --- a/sys/isa/atrtc.c +++ b/sys/isa/atrtc.c @@ -322,8 +322,18 @@ DELAY(int n) * takes about 1.5 usec for each of the i/o's in getit(). The loop * takes about 6 usec on a 486/33 and 13 usec on a 386/20. The * multiplications and divisions to scale the count take a while). + * + * However, if ddb is active then use a fake counter since reading + * the i8254 counter involves acquiring a lock. ddb must not go + * locking for many reasons, but it calls here for at least atkbd + * input. */ - prev_tick = getit(); +#ifdef DDB + if (db_active) + prev_tick = 0; + else +#endif + prev_tick = getit(); n -= 0; /* XXX actually guess no initial overhead */ /* * Calculate (n * (timer_freq / 1e6)) without using floating point @@ -350,7 +360,13 @@ DELAY(int n) / 1000000; while (ticks_left > 0) { - tick = getit(); +#ifdef DDB + if (db_active) { + inb(0x84); + tick = prev_tick + 1; + } else +#endif + tick = getit(); #ifdef DELAYDEBUG ++getit_calls; #endif |