[U-Boot-Users] [PATCH] PPC: Use r2 instead of r29 as global data pointer
Rafal Jaworowski
raj at semihalf.com
Sun Feb 17 17:20:31 CET 2008
Hello Wolfgang,
you wrote:
> R29 was an unlucky choice as with recent toolchains (gcc-4.2.x) gcc
> will refuse to use load/store multiple insns; instead, it issues a
> list of simple load/store instructions upon function entry and exit,
> resulting in bigger code size, which in turn makes the build for a
> few boards fail.
>
> Use r2 instead.
>
How about switching r14 (GOT ptr) to r13 in a similar way? Quite like the r2,
r13 is a dedicated register (small data area purposes) and it would let us
avoid using the -ffixed completely.
This would also resolve a general problem with standalone applications that is
lurking in the dark: the global data and GOT pointers are not saved/restored
upon exception/interrupt, so for example, upon a decrementer hit U-Boot code
starts using the dedicated regs blindly, but they could be scratched by the
app's code that was interrupted. This doesn't surface with the U-Boot in-tree
example applications, as they are built using system config.mk and contain
proper -ffixed tweaks and happen to be in sync, but this a general problem,
which should be addressed, as is biting applications built outside of U-Boot
tree..
If we used another dedicated register for GOT purposes, which applications
code would never use by definition, those issues dissapear. Otherwise we need
to provide explicit save/restore in the exception prologue/epilogue.
I can provide patches, but let me know your thoughts first.
kind regards,
Rafal
More information about the U-Boot
mailing list