On Thu, Sep 07, 2023 at 10:21:24AM +0200, Ahmad Fatoum wrote: > pbl_set_putc may be called by a PBL entry point to store the absolute > address of a routine to be used for printing out a character. > > If barebox happens to be located outside of the initially known RAM, > it will be relocated into it by means of relocate_to_adr(), but nothing > will take care to update the function pointer stored by pbl_set_putc. > > This will usually continue to work until barebox sets up the MMU and > everything not known to be RAM is marked as eXecute Never. After that, > the next PBL console print will trigger an instruction abort. > > Fix this by not storing the putc function pointer, but instead an offset > relative to _text. > > This fixes the issue of barebox hanging on i.MX8M when located at an address > greater than 4G. > > > I thought about going further and make pbl_set_putc callable, even > before relocation. The problem here is that runtime_address() may > not be called on global variables defined in the same file for good > reasons described in its documentation. So that's left as future > exercise. > > Ahmad Fatoum (2): > ARM: mmu64: mark barebox text section executable during early init > console: pbl: correctly handle relocate_to_adr after pbl_set_putc Applied, thanks Sascha > > arch/arm/cpu/mmu_64.c | 1 + > pbl/console.c | 13 ++++++++++--- > 2 files changed, 11 insertions(+), 3 deletions(-) > > -- > 2.39.2 > > > -- 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 |