From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rafal Jaworowski Date: Sun, 17 Feb 2008 17:20:31 +0100 Subject: [U-Boot-Users] [PATCH] PPC: Use r2 instead of r29 as global data pointer In-Reply-To: <1203027282-22398-1-git-send-email-wd@denx.de> References: <1203027282-22398-1-git-send-email-wd@denx.de> Message-ID: <47B85ECF.5080207@semihalf.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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