[PATCH] kdb line editing broken on x86_64

Jim Houston jim.houston at comcast.net
Tue Sep 28 07:29:31 PDT 2004


Hi Jack, Keith,

The line editing characters are not handled correctly in the 
x86_64 version of kdba_io.c.  The attached patch makes the
x86_64 code match the i386.

Jim Houston - Concurrent Computer Corp.

--

diff -urN -X /home/jhouston/dontdiff linux-2.6.8.1/arch/x86_64/kdb/kdba_io.c 2.6-redhawk/arch/x86_64/kdb/kdba_io.c
--- linux-2.6.8.1/arch/x86_64/kdb/kdba_io.c	2004-09-02 15:18:00.000000000 -0400
+++ 2.6-redhawk/arch/x86_64/kdb/kdba_io.c	2004-09-28 10:29:29.716570405 -0400
@@ -97,17 +97,6 @@
 		ch = serial_inp(&kdb_serial, UART_RX);
 		if (ch == 0x7f)
 			ch = 8;
-		if (ch == '\t')
-			ch = ' ';
-		if (ch == 8) {		/* BS */
-			;
-		} else if (ch == 13) {	/* Enter */
-			kdb_printf("\n");
-		} else {
-			if (!isprint(ch))
-				return(-1);
-			kdb_printf("%c", ch);
-		}
 		return ch;
 	}
 	return -1;
@@ -215,6 +204,26 @@
 		return 8;
 	}
 
+	/* Special Key */
+	switch (scancode) {
+	case 0xF: /* Tab */
+		return 9;
+	case 0x53: /* Del */
+		return 4;
+	case 0x47: /* Home */
+		return 1;
+	case 0x4F: /* End */
+		return 5;
+	case 0x4B: /* Left */
+		return 2;
+	case 0x48: /* Up */
+		return 16;
+	case 0x50: /* Down */
+		return 14;
+	case 0x4D: /* Right */
+		return 6;
+	}
+
 	if (scancode == 0xe0) {
 		return -1;
 	}
@@ -287,11 +296,6 @@
 		return 13;
 	}
 
-	/*
-	 * echo the character.
-	 */
-	kdb_printf("%c", keychar&0xff);
-
 	return keychar & 0xff;
 }
 
@@ -337,46 +341,6 @@
 	NULL
 };
 
-char *
-kdba_read(char *buffer, size_t bufsize)
-{
-	char	*cp = buffer;
-	char	*bufend = buffer+bufsize-2;	/* Reserve space for newline and null byte */
-
-	for (;;) {
-		int key;
-		get_char_func *f;
-		for (f = &poll_funcs[0]; ; ++f) {
-			if (*f == NULL) {
-				/* Reset NMI watchdog once per poll loop */
-				touch_nmi_watchdog();
-				f = &poll_funcs[0];
-			}
-			key = (*f)();
-			if (key != -1)
-				break;
-		}
-
-		/* Echo is done in the low level functions */
-		switch (key) {
-		case 8: /* backspace */
-			if (cp > buffer) {
-				kdb_printf("\b \b");
-				--cp;
-			}
-			break;
-		case 10: /* enter */
-		case 13: /* enter */
-			*cp++ = '\n';
-			*cp++ = '\0';
-			return buffer;
-		default:
-			if (cp < bufend)
-				*cp++ = key;
-			break;
-		}
-	}
-}
 
 void kdba_local_arch_setup(void)
 {
---------------------------
Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe.


More information about the kdb mailing list