On Sat, Apr 03, 2021 at 09:03:46AM +0200, Ahmad Fatoum wrote: > 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@xxxxxx> > --- > arch/arm/cpu/uncompress.c | 1 + > 1 file changed, 1 insertion(+) Applied, thanks Sascha > > 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 > > > _______________________________________________ > barebox mailing list > barebox@xxxxxxxxxxxxxxxxxxx > http://lists.infradead.org/mailman/listinfo/barebox > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox