[SLOF] [PATCH slof] ibm, client-architecture-support: Fix stack handling

Alexey Kardashevskiy aik at ozlabs.ru
Thu Dec 5 15:23:15 AEDT 2019


fdt-fix-cas-node returns the end address after it's finished which
the caller (ibm,client-architecture-support) does not use or drop.
This renames fdt-fix-cas-node to (fdt-fix-cas-node) and adds a wrapper
on top of that which does the drop. This will be used later for 2-pass
tree patching.

While at this, exit the function if memory allocation failed.

Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>
---
 board-qemu/slof/archsupport.fs | 8 ++++++--
 board-qemu/slof/fdt.fs         | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/board-qemu/slof/archsupport.fs b/board-qemu/slof/archsupport.fs
index 33ea765c152b..6512d57d50ec 100644
--- a/board-qemu/slof/archsupport.fs
+++ b/board-qemu/slof/archsupport.fs
@@ -18,7 +18,11 @@
     \ to come back to right boot device
     \ Allocate memory for H_CALL
     cas-buffer-size alloc-mem             ( vec memaddr )
-    dup 0= IF ." out of memory during ibm,client-architecture-support" cr THEN
+    dup 0= IF
+        ." out of memory during ibm,client-architecture-support" cr
+	2drop TRUE
+	EXIT
+    THEN
     swap over cas-buffer-size             ( memaddr vec memaddr size )
     \ make h_call to hypervisor
     hv-cas 0= IF                          ( memaddr )
@@ -28,7 +32,7 @@
 	    dup 4 + fdt-init
 	    fdt-check-header
 	    fdt-struct fdt-fix-cas-node
-	    fdt-fix-cas-success NOT
+	    fdt-fix-cas-success NOT       ( memaddr err? )
 	    s" /" find-node fdt-fix-phandles
 	ELSE
 	    FALSE
diff --git a/board-qemu/slof/fdt.fs b/board-qemu/slof/fdt.fs
index 3e4c1b34b8af..5ece270f7c0b 100644
--- a/board-qemu/slof/fdt.fs
+++ b/board-qemu/slof/fdt.fs
@@ -394,7 +394,7 @@ r> drop
     find-node ?dup 0 <> IF set-node THEN
 ;
 
-: fdt-fix-cas-node ( start -- end )
+: (fdt-fix-cas-node) ( start -- end )
     recursive
     fdt-next-tag dup OF_DT_BEGIN_NODE <> IF
 	." Error " cr
@@ -435,7 +435,7 @@ r> drop
 	ELSE dup OF_DT_BEGIN_NODE = IF
 		drop			( drop tag )
 		4 -
-		fdt-fix-cas-node
+		(fdt-fix-cas-node)
 		get-parent set-node
 		fdt-debug IF ." Returning back " pwd cr THEN
 	    ELSE
@@ -449,6 +449,10 @@ r> drop
     drop \ drop tag
 ;
 
+: fdt-fix-cas-node ( start -- )
+    (fdt-fix-cas-node) drop
+;
+
 : fdt-fix-cas-success
     fdt-cas-fix?
 ;
-- 
2.17.1



More information about the SLOF mailing list