[OpenBIOS] [commit] r1297 - trunk/openbios-devel/forth/system
repository service
svn at openbios.org
Mon May 12 17:44:01 CEST 2014
Author: mcayland
Date: Mon May 12 17:44:01 2014
New Revision: 1297
URL: http://tracker.coreboot.org/trac/openbios/changeset/1297
Log:
ciface.fs: handle buggy callers to test-method
SPARC64 *BSDs accidentally call test-method with an ihandle rather than a
phandle which causes OpenBIOS to crash. Work around this by checking to
ensure that the phandle exists within the tree before trying to use it.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
Modified:
trunk/openbios-devel/forth/system/ciface.fs
Modified: trunk/openbios-devel/forth/system/ciface.fs
==============================================================================
--- trunk/openbios-devel/forth/system/ciface.fs Mon May 12 17:43:57 2014 (r1296)
+++ trunk/openbios-devel/forth/system/ciface.fs Mon May 12 17:44:01 2014 (r1297)
@@ -55,6 +55,17 @@
." <" dup cstrlen dup 20 < if type else 2drop ." BAD" then ." >"
;
+: phandle-exists? ( phandle -- found? )
+ false swap 0
+ begin iterate-tree ?dup while
+ ( found? find-ph current-ph )
+ over over = if
+ rot drop true -rot
+ then
+ repeat
+ drop
+;
+
\ -------------------------------------------------------------
\ public interface
\ -------------------------------------------------------------
@@ -318,11 +329,15 @@
outer-interpreter
;
-( cstring-method phandle -- missing )
-
-: test-method
- swap dup cstrlen rot
- find-method 0= if -1 else drop 0 then
+: test-method ( cstring-method phandle -- missing? )
+ swap dup cstrlen rot
+
+ \ Check for incorrect phandle
+ dup phandle-exists? false = if
+ -1 throw
+ then
+
+ find-method 0= if -1 else drop 0 then
;
finish-device
More information about the OpenBIOS
mailing list