mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
Partially revert previous commit. Calling getit() unconditionally fixed
a problem that could also be fixed differently without reverting previous attempts to fix DELAY while the debugger is active (rev 1.204). The bug was that the i8254 implements a countdown timer, while for (k)db_active a countup timer was implemented. This resulted in premature termination and consequently the breakage of DELAY. The fix (relative to rev 1.211) is to implement a countdown timer for the kdb_active case. As such the ability to step clock initialization is preserved and DELAY does what is expected of it. Blushed: bde :-) Submitted by: bde
This commit is contained in:
parent
70c3c978b9
commit
45cfc0a914
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=131991
@ -401,10 +401,7 @@ getit(void)
|
||||
{
|
||||
int high, low;
|
||||
|
||||
#ifdef KDB
|
||||
if (!kdb_active)
|
||||
#endif
|
||||
mtx_lock_spin(&clock_lock);
|
||||
mtx_lock_spin(&clock_lock);
|
||||
|
||||
/* Select timer0 and latch counter value. */
|
||||
outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);
|
||||
@ -412,11 +409,7 @@ getit(void)
|
||||
low = inb(TIMER_CNTR0);
|
||||
high = inb(TIMER_CNTR0);
|
||||
|
||||
#ifdef KDB
|
||||
if (!kdb_active)
|
||||
#endif
|
||||
mtx_unlock_spin(&clock_lock);
|
||||
|
||||
mtx_unlock_spin(&clock_lock);
|
||||
return ((high << 8) | low);
|
||||
}
|
||||
|
||||
@ -457,8 +450,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 do
|
||||
* locking for many reasons, but it calls here for at least atkbd
|
||||
* input.
|
||||
*/
|
||||
prev_tick = getit();
|
||||
#ifdef KDB
|
||||
if (kdb_active)
|
||||
prev_tick = 1;
|
||||
else
|
||||
#endif
|
||||
prev_tick = getit();
|
||||
n -= 0; /* XXX actually guess no initial overhead */
|
||||
/*
|
||||
* Calculate (n * (timer_freq / 1e6)) without using floating point
|
||||
@ -485,7 +488,15 @@ DELAY(int n)
|
||||
/ 1000000;
|
||||
|
||||
while (ticks_left > 0) {
|
||||
tick = getit();
|
||||
#ifdef KDB
|
||||
if (kdb_active) {
|
||||
inb(0x84);
|
||||
tick = prev_tick - 1;
|
||||
if (tick <= 0)
|
||||
tick = timer0_max_count;
|
||||
} else
|
||||
#endif
|
||||
tick = getit();
|
||||
#ifdef DELAYDEBUG
|
||||
++getit_calls;
|
||||
#endif
|
||||
|
@ -401,10 +401,7 @@ getit(void)
|
||||
{
|
||||
int high, low;
|
||||
|
||||
#ifdef KDB
|
||||
if (!kdb_active)
|
||||
#endif
|
||||
mtx_lock_spin(&clock_lock);
|
||||
mtx_lock_spin(&clock_lock);
|
||||
|
||||
/* Select timer0 and latch counter value. */
|
||||
outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);
|
||||
@ -412,11 +409,7 @@ getit(void)
|
||||
low = inb(TIMER_CNTR0);
|
||||
high = inb(TIMER_CNTR0);
|
||||
|
||||
#ifdef KDB
|
||||
if (!kdb_active)
|
||||
#endif
|
||||
mtx_unlock_spin(&clock_lock);
|
||||
|
||||
mtx_unlock_spin(&clock_lock);
|
||||
return ((high << 8) | low);
|
||||
}
|
||||
|
||||
@ -457,8 +450,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 do
|
||||
* locking for many reasons, but it calls here for at least atkbd
|
||||
* input.
|
||||
*/
|
||||
prev_tick = getit();
|
||||
#ifdef KDB
|
||||
if (kdb_active)
|
||||
prev_tick = 1;
|
||||
else
|
||||
#endif
|
||||
prev_tick = getit();
|
||||
n -= 0; /* XXX actually guess no initial overhead */
|
||||
/*
|
||||
* Calculate (n * (timer_freq / 1e6)) without using floating point
|
||||
@ -485,7 +488,15 @@ DELAY(int n)
|
||||
/ 1000000;
|
||||
|
||||
while (ticks_left > 0) {
|
||||
tick = getit();
|
||||
#ifdef KDB
|
||||
if (kdb_active) {
|
||||
inb(0x84);
|
||||
tick = prev_tick - 1;
|
||||
if (tick <= 0)
|
||||
tick = timer0_max_count;
|
||||
} else
|
||||
#endif
|
||||
tick = getit();
|
||||
#ifdef DELAYDEBUG
|
||||
++getit_calls;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user