MFi386: machdep.c:1.570 clock.c:1.204 by bde: Quick fix for calling DELAY
for ddb input in some atkbd-based console drivers. ddb must not use any normal locks but DELAY() normally calls getit() which needs clock_lock. This also removes the need for recursion on clock_lock.
This commit is contained in:
parent
9cd1883cc6
commit
202f4eece1
@ -1166,7 +1166,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
|
||||
* 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);
|
||||
|
||||
/* exceptions */
|
||||
|
@ -413,8 +413,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
|
||||
@ -441,7 +451,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
|
||||
|
Loading…
x
Reference in New Issue
Block a user