Skip to contentSkip to conversation

GDB serial port debugging: Serial port cooked mode fix for high-bit multiplexing mode

PATCH New Dan Doucette 1 participant 1 message Dec 19, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GDB serial port debugging: Serial port cooked mode fix for high-bit multiplexing mode

This patch fixes a bug in the serial driver whereby carriage returns inserted in cooked mode are not send down the high bit set stream. If you are using the xenconsole on the high-bit-set stream (com1H), this issue manifests as staircase output.

% diffstat serial_patch

 serial.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

Dan.

xen/drivers/char/serial.c +14 -3
@@ -126,6 +126,7 @@
 {
     struct serial_port *port;
     unsigned long flags;
+    char cr;
 
     if ( handle == -1 )
         return;
@@ -137,7 +138,12 @@
     spin_lock_irqsave(&port->tx_lock, flags);
 
     if ( (c == '\n') && (handle & SERHND_COOKED) )
-        __serial_putc(port, '\r');
+    {
+        cr = '\r';
+        if ( handle & SERHND_HI )
+            cr |= 0x80;
+        __serial_putc(port, cr);
+    }
 
     if ( handle & SERHND_HI )
         c |= 0x80;
@@ -153,7 +159,7 @@
 {
     struct serial_port *port;
     unsigned long flags;
-    char c;
+    char c, cr;
 
     if ( handle == -1 )
         return;
@@ -167,7 +173,12 @@
     while ( (c = *s++) != '\0' )
     {
         if ( (c == '\n') && (handle & SERHND_COOKED) )
-            __serial_putc(port, '\r');
+        {
+            cr = '\r';
+            if ( handle & SERHND_HI )
+                cr |= 0x80;
+            __serial_putc(port, cr);
+        }
 
         if ( handle & SERHND_HI )
             c |= 0x80;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel