[U-Boot] [PATCH 1/4] mpc83xx: Make start.S true PIC
Joakim Tjernlund
joakim.tjernlund at transmode.se
Sun Jan 9 21:53:17 CET 2011
Wolfgang Denk <wd at denx.de> wrote on 2011/01/09 21:44:08:
>
> Dear Joakim Tjernlund,
>
> In message <1292838435-14958-1-git-send-email-Joakim.Tjernlund at transmode.se> you wrote:
> > Remove dependencies on link address. Use GOT and
> > add an new function to calculate the actual address.
> >
> > Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
> > ---
> > arch/powerpc/cpu/mpc83xx/start.S | 35 +++++++++++++++++++++++++++--------
> > 1 files changed, 27 insertions(+), 8 deletions(-)
>
> It seems this code introduces some subtle changes.
>
> > - lis r4, (CONFIG_SYS_MONITOR_BASE)@h
> > - ori r4, r4, (CONFIG_SYS_MONITOR_BASE)@l
> > - addi r5, r4, in_flash - _start + EXC_OFF_SYS_RESET
> > - mtlr r5
>
> The original code references CONFIG_SYS_MONITOR_BASE.
>
> > + bl add_flash_base
> ...
> > +add_flash_base:
> > + /* Check if already inside flash address space. */
> > + /* if so, do not add CONFIG_SYS_FLASH_BASE */
> > + lis r4, (CONFIG_SYS_FLASH_BASE)@h
> > + ori r4, r4, (CONFIG_SYS_FLASH_BASE)@l
> > + cmplw cr0, r3, r4
> > + ble cr0, 2f /* r3 < r4 ? */
> > + lis r6, (CONFIG_SYS_FLASH_BASE+(CONFIG_SYS_FLASH_SIZE*1024*1024-1))@h
> > + ori r6, r6, (CONFIG_SYS_FLASH_BASE+(CONFIG_SYS_FLASH_SIZE*1024*1024-1))@l
> > + cmplw cr0, r3, r6
> > + blelr cr0 /* r3 < r6 ? */
> > +2: add r3,r3,r4
> > + blr
>
> But your new code does not reference CONFIG_SYS_MONITOR_BASE at all,
> but uses CONFIG_SYS_FLASH_BASE instead.
You can't assume a fixed address when doing PIC therefore the change.
>
>
> On which boards has this been tested?
Only on our custom 83xx boards.
More information about the U-Boot
mailing list