svn commit: r186129 - user/dfr/xenhvm/6/sys/dev/xen/console

Doug Rabson dfr at FreeBSD.org
Mon Dec 15 07:41:29 PST 2008


Author: dfr
Date: Mon Dec 15 15:41:28 2008
New Revision: 186129
URL: http://svn.freebsd.org/changeset/base/186129

Log:
  Make console input work when in DDB.

Modified:
  user/dfr/xenhvm/6/sys/dev/xen/console/console.c

Modified: user/dfr/xenhvm/6/sys/dev/xen/console/console.c
==============================================================================
--- user/dfr/xenhvm/6/sys/dev/xen/console/console.c	Mon Dec 15 15:31:10 2008	(r186128)
+++ user/dfr/xenhvm/6/sys/dev/xen/console/console.c	Mon Dec 15 15:41:28 2008	(r186129)
@@ -19,6 +19,7 @@
 #include <xen/xen_intr.h>
 #include <sys/cons.h>
 #include <sys/proc.h>
+#include <sys/kdb.h>
 
 #include <dev/xen/console/xencons_ring.h>
 #include <xen/interface/io/console.h>
@@ -140,12 +141,17 @@ xccngetc(struct consdev *dev)
 	    	return 0;
 	do {
 		if ((c = xccncheckc(dev)) == -1) {
-			/* polling without sleeping in Xen doesn't work well. 
-			 * Sleeping gives other things like clock a chance to 
-			 * run
-			 */
-			tsleep(&cn_mtx, PWAIT | PCATCH, "console sleep", 
-			       XC_POLLTIME);
+#ifdef KDB
+			if (!kdb_active)
+#endif
+				/*
+				 * Polling without sleeping in Xen
+				 * doesn't work well.  Sleeping gives
+				 * other things like clock a chance to
+				 * run
+				 */
+				tsleep(&cn_mtx, PWAIT | PCATCH,
+				    "console sleep", XC_POLLTIME);
 		}
 	} while(c == -1);
 	return c;
@@ -155,11 +161,13 @@ int
 xccncheckc(struct consdev *dev)
 {
 	int ret = (xc_mute ? 0 : -1);
-	if (xencons_has_input()) 
-			xencons_handle_input(NULL);
+
+	if (xencons_has_input())
+		xencons_handle_input(NULL);
 	
 	CN_LOCK(cn_mtx);
 	if ((rp - rc)) {
+		if (kdb_active) printf("%s:%d\n", __func__, __LINE__);
 		/* we need to return only one char */
 		ret = (int)rbuf[RBUF_MASK(rc)];
 		rc++;
@@ -295,7 +303,11 @@ xencons_rx(char *buf, unsigned len)
 				HYPERVISOR_shared_info->evtchn_mask[0]);
 #endif
 	for (i = 0; i < len; i++) {
-		if (xen_console_up) 
+		if (xen_console_up
+#ifdef DDB
+			&& !kdb_active
+#endif
+			) 
 			(*linesw[tp->t_line]->l_rint)(buf[i], tp);
 		else
 			rbuf[RBUF_MASK(rp++)] = buf[i];
@@ -549,12 +561,3 @@ xcons_force_flush(void)
 }
 
 DRIVER_MODULE(xc, nexus, xc_driver, xc_devclass, 0, 0);
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 8
- * tab-width: 4
- * indent-tabs-mode: t
- * End:
- */


More information about the svn-src-user mailing list