[OpenBIOS] [commit] r1252 - trunk/openbios-devel/forth/device

repository service svn at openbios.org
Mon Jan 13 10:46:51 CET 2014


Author: mcayland
Date: Mon Jan 13 10:46:51 2014
New Revision: 1252
URL: http://tracker.coreboot.org/trac/openbios/changeset/1252

Log:
feval.fs: enable OpenBIOS to recover correctly from invalid FCode

If invalid FCode has been executed, the FCode interpreter may have exited
whilst still in compile mode, causing OpenBIOS internals to become corrupted.

Detect this condition and switch back to immediate mode to prevent subsequent
random internal errors within OpenBIOS.

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

Modified:
   trunk/openbios-devel/forth/device/feval.fs

Modified: trunk/openbios-devel/forth/device/feval.fs
==============================================================================
--- trunk/openbios-devel/forth/device/feval.fs	Mon Jan 13 10:46:46 2014	(r1251)
+++ trunk/openbios-devel/forth/device/feval.fs	Mon Jan 13 10:46:51 2014	(r1252)
@@ -49,6 +49,15 @@
       ,
     then
   fcode-end @ until
+
+  \ If we've executed incorrect FCode we may have reached the end of the FCode
+  \ program but still be in compile mode. Make sure that if this has happened
+  \ then we switch back to immediate mode to prevent internal OpenBIOS errors.
+  tmp-comp-depth @ -1 <> if
+    -1 tmp-comp-depth !
+    tmp-comp-buf @ @ here!
+    0 state !
+  then
 ;
 
 : byte-load ( addr xt -- )



More information about the OpenBIOS mailing list