summaryrefslogtreecommitdiffstats
path: root/sys/amd64/isa
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2004-07-10 22:42:22 +0000
committermarcel <marcel@FreeBSD.org>2004-07-10 22:42:22 +0000
commit1339cad36a69faf633824fea64a263b07318911b (patch)
tree5aeb0763bb33a73363ee01f0bcac2e778a328c66 /sys/amd64/isa
parent5d30d6766ff97dcc49a709f442967e03b52ef783 (diff)
downloadFreeBSD-src-1339cad36a69faf633824fea64a263b07318911b.zip
FreeBSD-src-1339cad36a69faf633824fea64a263b07318911b.tar.gz
MFi386: don't fake the time counter when the debugger is active.
This breaks the fundamental property of DELAY(). Instead, avoid grabbing clock_lock when kdb_active is non-zero.
Diffstat (limited to 'sys/amd64/isa')
-rw-r--r--sys/amd64/isa/clock.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c
index cfcf0d3..c311a2a 100644
--- a/sys/amd64/isa/clock.c
+++ b/sys/amd64/isa/clock.c
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#include <sys/kdb.h>
#include <sys/proc.h>
#include <sys/time.h>
#include <sys/timetc.h>
@@ -292,18 +293,8 @@ 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.
*/
-#ifdef DDB
- if (db_active)
- prev_tick = 0;
- else
-#endif
- prev_tick = getit();
+ prev_tick = getit();
n -= 0; /* XXX actually guess no initial overhead */
/*
* Calculate (n * (timer_freq / 1e6)) without using floating point
@@ -330,13 +321,7 @@ DELAY(int n)
/ 1000000;
while (ticks_left > 0) {
-#ifdef DDB
- if (db_active) {
- inb(0x84);
- tick = prev_tick + 1;
- } else
-#endif
- tick = getit();
+ tick = getit();
#ifdef DELAYDEBUG
++getit_calls;
#endif
@@ -381,10 +366,17 @@ sysbeep(int pitch, int period)
splx(x);
return (-1); /* XXX Should be EBUSY, but nobody cares anyway. */
}
- mtx_lock_spin(&clock_lock);
+#ifdef KDB
+ if (!kdb_active)
+#endif
+ mtx_lock_spin(&clock_lock);
outb(TIMER_CNTR2, pitch);
outb(TIMER_CNTR2, (pitch>>8));
- mtx_unlock_spin(&clock_lock);
+#ifdef KDB
+ if (!kdb_active)
+#endif
+ mtx_unlock_spin(&clock_lock);
+
if (!beeping) {
/* enable counter2 output to speaker */
outb(IO_PPI, inb(IO_PPI) | 3);
OpenPOWER on IntegriCloud