diff options
author | bde <bde@FreeBSD.org> | 2003-09-07 14:23:08 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2003-09-07 14:23:08 +0000 |
commit | bc4334bd197dcc51c53c30a538178bc696984a1b (patch) | |
tree | 55d005beb572003839ca45eab12db7da3884ae7c /usr.bin/colldef | |
parent | 34673ebfc37763889cbbdea9a6682a0ec1a559e1 (diff) | |
download | FreeBSD-src-bc4334bd197dcc51c53c30a538178bc696984a1b.zip FreeBSD-src-bc4334bd197dcc51c53c30a538178bc696984a1b.tar.gz |
clock.c:
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. One problem with using
normal locks in ddb is that deadlock is possible, but deadlock on
clock_lock is unlikely becaluse clock_lock is bogusly recursive,
apparently just to hide the problem of ddb using it. The i8254 clock
hardware has mostly write-only registers so it is important for it to
use a lock that gives exclusive access. (atkbd hardware is also
unfriendly to reentrant software but that problem is more local and
already solved.) I mostly saw the symptoms of the bug caused by
unlocking in getit() running cpu_unpend(). cpu_unpend() should not
be called while in ddb and Debugger() calls for failing assertions
about this caused a breakpoint within ddb.
ddb must also not call getit() because ddb may be being used to step
through clock initialization code that has stopped or otherwise mangled
the clock. If the clock is stopped, then getit() always returns the
same value and DELAY() takes forever if it trusts getit().
The quick fix is implement DELAY(n) as (n * timer_freq / 1000000)
inb(0x84)'s if ddb is active.
machdep.c:
Don't permit recursion on clock_lock.
Diffstat (limited to 'usr.bin/colldef')
0 files changed, 0 insertions, 0 deletions