PERFORCE change 49938 for review

Marcel Moolenaar marcel at FreeBSD.org
Mon Mar 29 20:21:06 PST 2004


http://perforce.freebsd.org/chv.cgi?CH=49938

Change 49938 by marcel at marcel_nfs on 2004/03/29 20:20:59

	Don't mutilate DELAY() when the debugger is active. If the
	sole reason for not calling getit() is to avoid locking,
	then it's infinitely better to just don't lock in getit().
	That way DELAY() will at least deliver on its promise to
	delay. This unbreaks uart(4) when used as a debug port on
	i386 at low speeds.

Affected files ...

.. //depot/projects/gdb/sys/i386/isa/clock.c#3 edit

Differences ...

==== //depot/projects/gdb/sys/i386/isa/clock.c#3 (text+ko) ====

@@ -403,7 +403,10 @@
 {
 	int high, low;
 
-	mtx_lock_spin(&clock_lock);
+#ifdef KDB
+	if (!kdb_active)
+		mtx_lock_spin(&clock_lock);
+#endif
 
 	/* Select timer0 and latch counter value. */
 	outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);
@@ -411,7 +414,11 @@
 	low = inb(TIMER_CNTR0);
 	high = inb(TIMER_CNTR0);
 
-	mtx_unlock_spin(&clock_lock);
+#ifdef KDB
+	if (!kdb_active)
+		mtx_unlock_spin(&clock_lock);
+#endif
+
 	return ((high << 8) | low);
 }
 
@@ -458,12 +465,7 @@
 	 * locking for many reasons, but it calls here for at least atkbd
 	 * input.
 	 */
-#ifdef KDB
-	if (kdb_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
@@ -490,13 +492,7 @@
 			     / 1000000;
 
 	while (ticks_left > 0) {
-#ifdef KDB
-		if (kdb_active) {
-			inb(0x84);
-			tick = prev_tick + 1;
-		} else
-#endif
-			tick = getit();
+		tick = getit();
 #ifdef DELAYDEBUG
 		++getit_calls;
 #endif


More information about the p4-projects mailing list