summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad@a3f.at>2021-04-03 09:03:46 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-04-13 09:47:45 +0200
commit9441630d35d6fadf0446b5b60d7f3b2c27ec1d02 (patch)
treeaf98100f42739324fef802fdfbe4e3604861f173 /arch
parentfe14a93fe6a22243892785ceafd086a75b6c9253 (diff)
downloadbarebox-9441630d35d6fadf0446b5b60d7f3b2c27ec1d02.tar.gz
barebox-9441630d35d6fadf0446b5b60d7f3b2c27ec1d02.tar.xz
ARM: pbl: uncompress: add comment explaining order of operations
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@a3f.at> Link: https://lore.pengutronix.de/20210403070346.3643335-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/cpu/uncompress.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
index db0fe98e0d..2250b8ccd3 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();