[OpenBIOS] [RFC] [PATCH] Redefine "to" word in device.fs to allow the current package to be set like a standard value.
mark.cave-ayland at ilande.co.uk
Fri Nov 30 14:55:12 CET 2012
BootX appears to be able to want to change the current package phandle by
executing Forth statements in the form "<value> to active-package". This won't
work correctly in OpenBIOS, since changing packages requires calling the
active-package! word to perform additional housekeeping such as changing
The proposed solution here is to redefine "to" at the end of device.fs so that if
package support is included, we perform an additional check on the destination xt
to see if it matches that of active-package. If it does, then we manually invoke
the active-package! word to select the new package.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
openbios-devel/forth/bootstrap/bootstrap.fs | 12 ++++++++----
openbios-devel/forth/device/device.fs | 11 +++++++++++
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/openbios-devel/forth/bootstrap/bootstrap.fs b/openbios-devel/forth/bootstrap/bootstrap.fs
index f295e4e..6878449 100644
@@ -1052,17 +1052,21 @@ variable #instance
3 /n* + !
- ['] ' execute
+: (to-xt) ( xt -- )
dup @ instance-cfa?
state @ if
swap ['] (lit) , , if ['] (ito) else ['] (to) then ,
if (ito) else /n + ! then
- ; immediate
+ ['] ' execute
+ ; immediate
: is ( xt "wordname<>" -- )
parse-word $find if
diff --git a/openbios-devel/forth/device/device.fs b/openbios-devel/forth/device/device.fs
index 4e025b9..562c919 100644
@@ -189,3 +189,14 @@ variable device-tree
+\ Redefine to word so that statements of the form "0 to active-package"
+\ are supported for bootloaders that require it
+ ['] ' execute
+ dup ['] active-package = if
+ drop active-package!
More information about the OpenBIOS