[OpenBIOS] [commit] r822 - trunk/openbios-devel/kernel

repository service svn at openbios.org
Sun Jul 25 19:34:13 CEST 2010


Author: mcayland
Date: Sun Jul 25 19:34:13 2010
New Revision: 822
URL: http://tracker.coreboot.org/trac/openbios/changeset/822

Log:
Create a C wrapper around the Forth key word to be used in the debugger instead of calling availchar()/getchar(). Using this 
wrapper means that the debugger now works correctly under PPC.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at siriusit.co.uk>

Modified:
   trunk/openbios-devel/kernel/internal.c

Modified: trunk/openbios-devel/kernel/internal.c
==============================================================================
--- trunk/openbios-devel/kernel/internal.c	Tue Jul 13 18:41:06 2010	(r821)
+++ trunk/openbios-devel/kernel/internal.c	Sun Jul 25 19:34:13 2010	(r822)
@@ -446,6 +446,27 @@
 	return i;
 }
 
+static
+int getchar_console( void )
+{
+	cell tmp;
+
+	/* Push to the Forth interpreter for console output */
+	tmp = rstackcnt;
+
+	trampoline[1] = findword("key");
+
+	PUSHR(PC);
+	PC = pointer2cell(trampoline);
+
+	while (rstackcnt > tmp) {
+		dbg_interp_printk("getchar_console: NEXT\n");
+		next();
+	}
+
+	return POP();
+}
+
 static void
 display_dbg_dstack ( void )
 {
@@ -567,8 +588,7 @@
 		return;
 
 	/* Otherwise in step mode, prompt for a keypress */
-	while (!availchar());
-	k = getchar();
+	k = getchar_console();
 
 	/* Only proceed if done is true */
 	while (!done)
@@ -601,8 +621,7 @@
 				/* Down - mark current word for debug and step into it */
 				done = add_debug_xt(read_ucell(cell2pointer(PC)));
 				if (!done) {
-					while (!availchar());
-					k = getchar();
+					k = getchar_console();
 				}
 				break;
 
@@ -618,8 +637,7 @@
 				/* Display rstack */
 				display_dbg_rstack();
 				done = 0;
-				while (!availchar());
-				k = getchar();
+				k = getchar_console();
 				break;
 
 			case 'f':
@@ -636,8 +654,7 @@
 			default:
 				/* Display debug banner */
 				printf_console(DEBUG_BANNER);
-				while (!availchar());
-				k = getchar();
+				k = getchar_console();
 		}
 	}
 }



More information about the OpenBIOS mailing list