From 50e344721cd440df1aad29ffeac9e02828914d5d Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Mon, 28 Jun 2010 05:16:15 +0000 Subject: [PATCH] Fix up parse word so that it can correctly handle empty arguments and (encode-bootpath) word so that it can handle optional arguments. With these fixes in place we can now switch the boot word to use (encode-bootpath) which means that the bootpath and bootarg properties are now set exactly the same when executing boot and/or load. Signed-off-by: Mark Cave-Ayland git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@803 f158a5a8-5612-0410-a976-696ce0be7e32 --- forth/admin/userboot.fs | 2 +- forth/bootstrap/bootstrap.fs | 5 +++++ forth/debugging/client.fs | 20 ++++++++++++++------ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/forth/admin/userboot.fs b/forth/admin/userboot.fs index 57ede6d..2de019c 100644 --- a/forth/admin/userboot.fs +++ b/forth/admin/userboot.fs @@ -1,7 +1,7 @@ \ 7.4.3.5 User commands for booting : boot ( "{param-text}" -- ) - linefeed parse cr + (encode-bootpath) s" platform-boot" $find if execute else diff --git a/forth/bootstrap/bootstrap.fs b/forth/bootstrap/bootstrap.fs index f2dea67..a7d6b19 100644 --- a/forth/bootstrap/bootstrap.fs +++ b/forth/bootstrap/bootstrap.fs @@ -704,6 +704,11 @@ variable span 0 span ! >r \ save delimiter ib >in @ + span @ >in @ - \ ib+offs len-offset. + dup 0 < if \ if we are already at the end of the string, return an empty string + + 0 \ move to end of input string + r> drop + exit + then 2dup r> \ ib+offs len-offset ib+offs len-offset delim findchar if \ look for the delimiter. nip dup 1+ diff --git a/forth/debugging/client.fs b/forth/debugging/client.fs index c7178df..7eafad9 100644 --- a/forth/debugging/client.fs +++ b/forth/debugging/client.fs @@ -56,13 +56,21 @@ variable file-size ; : (encode-bootpath) ( "{params}" -- bootpath-str bootpath-len) - bl parse 2dup encode-string - " /chosen" (find-dev) if - " bootpath" rot (property) + \ Parse the current input buffer of a load/boot command and set both + \ the bootargs and bootpath properties as appropriate. + bl parse dup if + 2dup encode-string + " /chosen" (find-dev) if + " bootpath" rot (property) + then then - linefeed parse encode-string - " /chosen" (find-dev) if - " bootargs" rot (property) + linefeed parse dup if + encode-string + " /chosen" (find-dev) if + " bootargs" rot (property) + then + else + 2drop then ;