diff --git a/sys/arch/macppc/dev/adb_direct.c b/sys/arch/macppc/dev/adb_direct.c index 1d9f4389e050..de35e16d3b99 100644 --- a/sys/arch/macppc/dev/adb_direct.c +++ b/sys/arch/macppc/dev/adb_direct.c @@ -1,4 +1,4 @@ -/* $NetBSD: adb_direct.c,v 1.20 2002/01/02 20:30:45 dbj Exp $ */ +/* $NetBSD: adb_direct.c,v 1.21 2002/02/23 10:47:16 dbj Exp $ */ /* From: adb_direct.c 2.02 4/18/97 jpw */ @@ -1006,6 +1006,17 @@ adb_soft_intr(void) print_single(adbInbound[adbInHead].data); } #endif + /* Remove the packet from the queue before calling + * the completion routine, so that the completion + * routine can reentrantly process the queue. For + * example, this happens when polling is turned on + * by entering the debuger by keystroke. + */ + s = splhigh(); + adbInCount--; + if (++adbInHead >= ADB_QUEUE) + adbInHead = 0; + splx(s); /* call default completion routine if it's valid */ if (comprout) { @@ -1014,13 +1025,6 @@ adb_soft_intr(void) (*f)(buffer, compdata, cmd); } - - s = splhigh(); - adbInCount--; - if (++adbInHead >= ADB_QUEUE) - adbInHead = 0; - splx(s); - } return; }