Author: mcayland Date: Fri Dec 7 15:28:07 2012 New Revision: 1077 URL: http://tracker.coreboot.org/trac/openbios/changeset/1077
Log: Redefine "to" word in device.fs to allow the current package to be set like a standard value.
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 wordlists.
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@ilande.co.uk
Modified: trunk/openbios-devel/forth/bootstrap/bootstrap.fs trunk/openbios-devel/forth/device/device.fs
Modified: trunk/openbios-devel/forth/bootstrap/bootstrap.fs ============================================================================== --- trunk/openbios-devel/forth/bootstrap/bootstrap.fs Fri Dec 7 15:18:41 2012 (r1076) +++ trunk/openbios-devel/forth/bootstrap/bootstrap.fs Fri Dec 7 15:28:07 2012 (r1077) @@ -1052,17 +1052,21 @@ 3 /n* + ! then ; - -: to - ['] ' execute + +: (to-xt) ( xt -- ) dup @ instance-cfa? state @ if swap ['] (lit) , , if ['] (ito) else ['] (to) then , else if (ito) else /n + ! then then - ; immediate +;
+: to + ['] ' execute + (to-xt) + ; immediate + : is ( xt "wordname<>" -- ) parse-word $find if (to)
Modified: trunk/openbios-devel/forth/device/device.fs ============================================================================== --- trunk/openbios-devel/forth/device/device.fs Fri Dec 7 15:18:41 2012 (r1076) +++ trunk/openbios-devel/forth/device/device.fs Fri Dec 7 15:28:07 2012 (r1077) @@ -189,3 +189,14 @@ free-mem then ; + +\ Redefine to word so that statements of the form "0 to active-package" +\ are supported for bootloaders that require it +: to + ['] ' execute + dup ['] active-package = if + drop active-package! + else + (to-xt) + then +; immediate