[OpenBIOS] [commit] r854 - in trunk/openbios-devel/forth: admin debugging

repository service svn at openbios.org
Sat Aug 21 12:21:01 CEST 2010


Author: mcayland
Date: Sat Aug 21 12:21:01 2010
New Revision: 854
URL: http://tracker.coreboot.org/trac/openbios/changeset/854

Log:
Alter (encode-bootpath) so that it processes a string on the stack rather than using the parse buffer directly. This enables us 
to ensure that execution of any platform-specific boot code can occur before the main "load & go" boot, even if they invoke 
Forth commands that alter the parse buffer.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at siriusit.co.uk>

Modified:
   trunk/openbios-devel/forth/admin/userboot.fs
   trunk/openbios-devel/forth/debugging/client.fs

Modified: trunk/openbios-devel/forth/admin/userboot.fs
==============================================================================
--- trunk/openbios-devel/forth/admin/userboot.fs	Tue Aug 17 17:42:10 2010	(r853)
+++ trunk/openbios-devel/forth/admin/userboot.fs	Sat Aug 21 12:21:01 2010	(r854)
@@ -1,10 +1,22 @@
 \ 7.4.3.5 User commands for booting
 
 : boot		( "{param-text}<cr>" -- )
-  (encode-bootpath)	\ Setup bootpath/bootargs
+  linefeed parse
+
+  \ Copy NVRAM parameters from boot-file to bootargs in case any parameters have
+  \ been specified for the platform-specific boot code
+  s" boot-file" $find drop execute
+  encode-string
+  " /chosen" (find-dev) if
+    " bootargs" rot (property)
+  then
+
+  \ Execute platform-specific boot code, e.g. kernel
   s" platform-boot" $find if 
-    execute		\ Execute platform-specific boot code
+    execute		
   then
+
+  (encode-bootpath)	\ Setup bootpath/bootargs
   $load			\ load and go
   go
 ;

Modified: trunk/openbios-devel/forth/debugging/client.fs
==============================================================================
--- trunk/openbios-devel/forth/debugging/client.fs	Tue Aug 17 17:42:10 2010	(r853)
+++ trunk/openbios-devel/forth/debugging/client.fs	Sat Aug 21 12:21:01 2010	(r854)
@@ -55,16 +55,19 @@
   then
   ;
 
-: (encode-bootpath) ( "{params}<cr>" -- bootpath-str bootpath-len)
-  \ Parse the current input buffer of a load/boot command and set both
+: (encode-bootpath) ( param-str param-len -- bootpath-str bootpath-len)
+  \ Parse the <param> string from a load/boot command and set both
   \ the bootargs and bootpath properties as appropriate.
-  cr
 
   \ bootpath
-  bl parse dup 0= if
+  bl left-split 	\ argstr argstr-len bootdevstr bootdevstr-len
+  dup 0= if
 
     \ None specified. As per IEEE-1275 specification, search through each value
     \ in boot-device and use the first that returns a valid ihandle on open.
+
+    2drop		\ drop the empty device string as we're going to use our own
+
     s" boot-device" $find drop execute 
     bl left-split
     begin 
@@ -80,8 +83,6 @@
       then
     repeat
     2drop
-  else
-    0 0 2swap		\ Fake (empty) parse string
   then
 
   \ Set the bootpath property
@@ -91,7 +92,7 @@
   then
 
   \ bootargs
-  linefeed parse dup 0= if
+  2swap dup 0= if
     \ None specified, use default from nvram
     2drop s" boot-file" $find drop execute
   then
@@ -101,9 +102,6 @@
   " /chosen" (find-dev) if
     " bootargs" rot (property)
   then
-
-  \ Remove the remaining string
-  2swap 2drop
 ;
 
 : $load ( devstr len )
@@ -121,6 +119,7 @@
   ;
 
 : load    ( "{params}<cr>" -- )
+  linefeed parse
   (encode-bootpath)
   $load
 ;



More information about the OpenBIOS mailing list