[PATCH] ARM: pbl: uncompress: add comment explaining order of operations
Ahmad Fatoum
ahmad at a3f.at
Sat Apr 3 08:03:46 BST 2021
When the PBL runs from flash, it relocates to RAM prior to extracting
barebox proper. It does the sneaky thing of _not_ relocating the piggy
data though, so read from flash and uncompression may latter happen
at the same time.
For this to work, it's critical that the variables pointing at the piggy
data are evaluated before relocation. ARM does so and carefully uses
them to derive the address of the PBL size later on instead of
evaluating image_data_end again.
When I ported the same code for RISC-V use, this got lost. Add a comment
explaining the criticality of maintaining this order of operations.
Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
---
arch/arm/cpu/uncompress.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
index db0fe98e0d83..2250b8ccd375 100644
--- a/arch/arm/cpu/uncompress.c
+++ b/arch/arm/cpu/uncompress.c
@@ -52,6 +52,7 @@ void __noreturn barebox_pbl_start(unsigned long membase, unsigned long memsize,
void *pg_start, *pg_end;
unsigned long pc = get_pc();
+ /* piggy data is not relocated, so determine the bounds now */
pg_start = input_data + global_variable_offset();
pg_end = input_data_end + global_variable_offset();
--
2.30.0
More information about the barebox
mailing list