j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
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 --- 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 --- a/openbios-devel/forth/bootstrap/bootstrap.fs +++ b/openbios-devel/forth/bootstrap/bootstrap.fs @@ -1052,17 +1052,21 @@ variable #instance 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) diff --git a/openbios-devel/forth/device/device.fs b/openbios-devel/forth/device/device.fs index 4e025b9..562c919 100644 --- a/openbios-devel/forth/device/device.fs +++ b/openbios-devel/forth/device/device.fs @@ -189,3 +189,14 @@ variable device-tree 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