summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordrahn <drahn@openbsd.org>2004-05-28 23:50:58 +0000
committerdrahn <drahn@openbsd.org>2004-05-28 23:50:58 +0000
commitde0499e9376ebd1ac235a23fe5793887b826501b (patch)
tree912f66b87b8079830c6820d3fd7f1d0bd4dd24fc
parentClean up sense error logic and printing a bit, partly inspired by (diff)
downloadwireguard-openbsd-de0499e9376ebd1ac235a23fe5793887b826501b.tar.xz
wireguard-openbsd-de0499e9376ebd1ac235a23fe5793887b826501b.zip
Modify adb packet handling so that the completion routine can reentrantly
process the queue. fix from netbsd, pointed out on ppc@ several times. Doesn't appear to affect my machines, but helps others.
-rw-r--r--sys/arch/macppc/dev/adb_direct.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/sys/arch/macppc/dev/adb_direct.c b/sys/arch/macppc/dev/adb_direct.c
index 0e4e931847d..cc8823ea1a2 100644
--- a/sys/arch/macppc/dev/adb_direct.c
+++ b/sys/arch/macppc/dev/adb_direct.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adb_direct.c,v 1.10 2003/11/03 06:43:02 david Exp $ */
+/* $OpenBSD: adb_direct.c,v 1.11 2004/05/28 23:50:58 drahn Exp $ */
/* $NetBSD: adb_direct.c,v 1.14 2000/06/08 22:10:45 tsubai Exp $ */
/*
@@ -806,6 +806,18 @@ 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) {
@@ -813,12 +825,6 @@ adb_soft_intr(void)
(buffer, compdata, cmd);
}
- s = splhigh();
- adbInCount--;
- if (++adbInHead >= ADB_QUEUE)
- adbInHead = 0;
- splx(s);
-
}
}