]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
PPC: Use r2 instead of r29 as global data pointer
authorWolfgang Denk <wd@denx.de>
Thu, 14 Feb 2008 21:43:22 +0000 (22:43 +0100)
committerWolfgang Denk <wd@denx.de>
Thu, 14 Feb 2008 21:43:22 +0000 (22:43 +0100)
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.

Signed-off-by: Wolfgang Denk <wd@denx.de>
19 files changed:
README
cpu/74xx_7xx/config.mk
cpu/mpc512x/config.mk
cpu/mpc5xx/config.mk
cpu/mpc5xxx/config.mk
cpu/mpc8220/config.mk
cpu/mpc824x/config.mk
cpu/mpc8260/config.mk
cpu/mpc83xx/config.mk
cpu/mpc85xx/config.mk
cpu/mpc86xx/config.mk
cpu/mpc86xx/start.S
cpu/mpc8xx/config.mk
cpu/ppc4xx/config.mk
doc/README.standalone
examples/stubs.c
examples/test_burst_lib.S
examples/x86-testapp.c
include/asm-ppc/global_data.h

diff --git a/README b/README
index a5ffbb5ad15cad1cf5faef53566562b0b5cabaf4..b4966a0df669949a2cd15f1139598bedfd0b2e9c 100644 (file)
--- a/README
+++ b/README
@@ -3499,7 +3499,7 @@ GCC's implementation.
 
 For PowerPC, the following registers have specific use:
        R1:     stack pointer
-       R2:     TOC pointer
+       R2:     reserved for system use
        R3-R4:  parameter passing and return values
        R5-R10: parameter passing
        R13:    small data area pointer
@@ -3508,7 +3508,7 @@ For PowerPC, the following registers have specific use:
 
        (U-Boot also uses R14 as internal GOT pointer.)
 
-    ==> U-Boot will use R29 to hold a pointer to the global data
+    ==> U-Boot will use R2 to hold a pointer to the global data
 
     Note: on PPC, we could use a static initializer (since the
     address of the global data structure is known at compile time),
index 417d99f33bedb44012da0d845d8b1d78c5aadc8e..324f62b836da85354c1d191d1f39cfcf55a1ec19 100644 (file)
@@ -23,4 +23,4 @@
 
 PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing
 
-PLATFORM_CPPFLAGS += -DCONFIG_74xx_7xx -ffixed-r2 -ffixed-r29 -mstring
+PLATFORM_CPPFLAGS += -DCONFIG_74xx_7xx -ffixed-r2 -mstring
index 8a07c5a3b679cc4c0308c32de290ab70eb4d661a..5b7e1f2682b8c3829e26897efed16284b06e9a29 100644 (file)
@@ -22,4 +22,4 @@
 PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi
 
 PLATFORM_CPPFLAGS += -DCONFIG_MPC512X -DCONFIG_E300 \
-                       -ffixed-r2 -ffixed-r29 -msoft-float -mcpu=603e
+                       -ffixed-r2 -msoft-float -mcpu=603e
index 64cd60071ad4085ab2ae1b583545ce51bccb68f1..6d66c32bee181b3b722bd7f5e5f81d949e7f297c 100644 (file)
@@ -30,7 +30,7 @@
 
 PLATFORM_RELFLAGS +=   -fPIC -ffixed-r14 -meabi
 
-PLATFORM_CPPFLAGS +=   -DCONFIG_5xx -ffixed-r2 -ffixed-r29 -mpowerpc -msoft-float
+PLATFORM_CPPFLAGS +=   -DCONFIG_5xx -ffixed-r2 -mpowerpc -msoft-float
 
 # Use default linker script.  Board port can override in board/*/config.mk
 LDSCRIPT := $(SRCTREE)/cpu/mpc5xx/u-boot.lds
index 0df51babd70b558cb1649bd8031a202e003e3b49..b0ce2ee9e3ee05aa66d1ce315aaf9bd58a3cb719 100644 (file)
@@ -23,7 +23,7 @@
 
 PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi
 
-PLATFORM_CPPFLAGS += -DCONFIG_MPC5xxx -ffixed-r2 -ffixed-r29 \
+PLATFORM_CPPFLAGS += -DCONFIG_MPC5xxx -ffixed-r2 \
                     -mstring -mcpu=603e -mmultiple
 
 # Use default linker script.  Board port can override in board/*/config.mk
index 8e3ba54287cbab5b70975f8bba9f847277e91013..5819048d01ab5367d8fc0738d46770208192100b 100644 (file)
@@ -23,7 +23,7 @@
 
 PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi
 
-PLATFORM_CPPFLAGS += -DCONFIG_MPC8220 -ffixed-r2 -ffixed-r29 \
+PLATFORM_CPPFLAGS += -DCONFIG_MPC8220 -ffixed-r2 \
                     -mstring -mcpu=603e -mmultiple
 
 # Use default linker script.  Board port can override in board/*/config.mk
index 66207f4354dfac4b59089ff895f5b2bfc1248d4e..1bb0487bd3ba464233dfc765bf26053de9724fec 100644 (file)
@@ -23,7 +23,7 @@
 
 PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing
 
-PLATFORM_CPPFLAGS += -DCONFIG_MPC824X -ffixed-r2 -ffixed-r29 -mstring -mcpu=603e -msoft-float
+PLATFORM_CPPFLAGS += -DCONFIG_MPC824X -ffixed-r2 -mstring -mcpu=603e -msoft-float
 
 # Use default linker script.  Board port can override in board/*/config.mk
 LDSCRIPT := $(SRCTREE)/cpu/mpc824x/u-boot.lds
index 683b6fbf2b2f16f194d8073a2d2248b63829d361..2cb027093b030a0f8fc4d852cbf291206a565903 100644 (file)
@@ -23,7 +23,7 @@
 
 PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi
 
-PLATFORM_CPPFLAGS += -DCONFIG_8260 -DCONFIG_CPM2 -ffixed-r2 -ffixed-r29 \
+PLATFORM_CPPFLAGS += -DCONFIG_8260 -DCONFIG_CPM2 -ffixed-r2 \
                     -mstring -mcpu=603e -mmultiple
 
 # Use default linker script.  Board port can override in board/*/config.mk
index ecf8a60bbefa19441fce6396aa65947e5c52fdc1..2f0f1ce1efbecdec3e721b95733bdfa93b2cd6d8 100644 (file)
@@ -23,7 +23,7 @@
 PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi
 
 PLATFORM_CPPFLAGS += -DCONFIG_MPC83XX -DCONFIG_E300 \
-                       -ffixed-r2 -ffixed-r29 -msoft-float
+                       -ffixed-r2 -msoft-float
 
 # Use default linker script.  Board port can override in board/*/config.mk
 LDSCRIPT := $(SRCTREE)/cpu/mpc83xx/u-boot.lds
index 61210743490c4afb409e0d2d33c1b4d4c818e29f..f6df702e52697de512a2eb99c9fca04c1c5d748b 100644 (file)
@@ -23,4 +23,5 @@
 
 PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi
 
-PLATFORM_CPPFLAGS += -DCONFIG_MPC85xx -DCONFIG_E500 -ffixed-r2 -ffixed-r29 -Wa,-me500 -msoft-float -mno-string
+PLATFORM_CPPFLAGS += -DCONFIG_MPC85xx -DCONFIG_E500 -ffixed-r2 \
+                       -Wa,-me500 -msoft-float -mno-string
index 3c54f4ad39f8a13bcedc6ef85ce550a7b301342f..d767269ad3ddd3655398bc7c929672aeb7aa6036 100644 (file)
@@ -23,4 +23,4 @@
 
 PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi
 
-PLATFORM_CPPFLAGS += -DCONFIG_MPC86xx -ffixed-r2 -ffixed-r29 -mstring
+PLATFORM_CPPFLAGS += -DCONFIG_MPC86xx -ffixed-r2 -mstring
index fa9736bce0b69311519264638ec76296f3cbaa45..09f4ceedb573ddb6fc7256b36ac4563f10445499 100644 (file)
@@ -723,7 +723,7 @@ relocate_code:
 
        mr      r1,  r3         /* Set new stack pointer                */
        mr      r9,  r4         /* Save copy of Global Data pointer     */
-       mr      r29, r9         /* Save for DECLARE_GLOBAL_DATA_PTR     */
+       mr      r2 r9         /* Save for DECLARE_GLOBAL_DATA_PTR     */
        mr      r10, r5         /* Save copy of Destination Address     */
 
        mr      r3,  r5                         /* Destination Address  */
index bfa6625fa8481b567854f5b67d21a45ebdf7312c..6031e7f76af9502e27392a4c1b925a4257ff7deb 100644 (file)
@@ -23,4 +23,4 @@
 
 PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing
 
-PLATFORM_CPPFLAGS += -DCONFIG_8xx -ffixed-r2 -ffixed-r29 -mstring -mcpu=860 -msoft-float
+PLATFORM_CPPFLAGS += -DCONFIG_8xx -ffixed-r2 -mstring -mcpu=860 -msoft-float
index 4fd510899c59c1c42143804612f8bbf875d89926..311c97b732391f796549f5a205dd8934ec2e7f81 100644 (file)
@@ -22,7 +22,7 @@
 #
 
 PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing
-PLATFORM_CPPFLAGS += -DCONFIG_4xx -ffixed-r2 -ffixed-r29 -mstring -msoft-float
+PLATFORM_CPPFLAGS += -DCONFIG_4xx -ffixed-r2 -mstring -msoft-float
 
 cfg=$(shell grep configs $(OBJTREE)/include/config.h | sed 's/.*<\(configs.*\)>/\1/')
 is440=$(shell grep CONFIG_440 $(TOPDIR)/include/$(cfg))
index 39988317ee5971abf7240bf01e641e30aeb71aa3..f9237a65f573a529c62b23769978f5c2dbdcb467 100644 (file)
@@ -21,7 +21,7 @@ Design Notes on Exporting U-Boot Functions to Standalone Applications:
 2. The pointer to the jump table is passed to the application in a
    machine-dependent way. PowerPC, ARM and MIPS architectures use a
    dedicated register to hold the pointer to the 'global_data'
-   structure: r29 on PowerPC, r8 on ARM and k0 on MIPS. The x86
+   structure: r2 on PowerPC, r8 on ARM and k0 on MIPS. The x86
    architecture does not use such a register; instead, the pointer to
    the 'global_data' structure is passed as 'argv[-1]' pointer.
 
index 571c4d50a437e905a289a177b4a4721e24850b1d..9b3cadde33f997fd4d3f91ff99444ad738edc8a6 100644 (file)
@@ -25,14 +25,14 @@ gd_t *global_data;
        : : "i"(XF_ ## x * sizeof(void *)) : "eax", "ecx");
 #elif defined(CONFIG_PPC)
 /*
- * r29 holds the pointer to the global_data, r11 is a call-clobbered
+ * r2 holds the pointer to the global_data, r11 is a call-clobbered
  * register
  */
 #define EXPORT_FUNC(x) \
        asm volatile (                  \
 "      .globl " #x "\n"                \
 #x ":\n"                               \
-"      lwz     %%r11, %0(%%r29)\n"     \
+"      lwz     %%r11, %0(%%r2)\n"      \
 "      lwz     %%r11, %1(%%r11)\n"     \
 "      mtctr   %%r11\n"                \
 "      bctr\n"                         \
index 5bb49814284028e7e471d847b53bc1503c805b94..aef4e324224e7dfbb706e404f5e8564a25758b91 100644 (file)
@@ -70,7 +70,7 @@ mmu_init:
         * we can load the instruction and data TLB registers with the
         * same values.
         */
-       lwz     r9,20(r29)              /* gd->ram_size */
+       lwz     r9,20(r2              /* gd->ram_size */
        addis   r9,r9,-0x80
 
        mr      r8, r9                  /* Higher 8 Meg in SDRAM */
index a1ab319ae885e333ad149642ec0377cfc1eba606..e8603d9bac6047009b5ebabcae920019bd0b2405 100644 (file)
@@ -30,11 +30,11 @@ asm volatile (                                              \
 asm volatile (                                         \
 "      .globl mon_" #x "\n"                            \
 "mon_" #x ":\n"                                                \
-"      lwz     %%r11, %0(%%r29)\n"                     \
+"      lwz     %%r11, %0(%%r2)\n"                      \
 "      lwz     %%r11, %1(%%r11)\n"                     \
 "      mtctr   %%r11\n"                                \
 "      bctr\n"                                 \
-       : : "i"(offsetof(xxx_t, pfunc)), "i"(XF_ ## x * sizeof(void *)) : "r11", "r29");
+       : : "i"(offsetof(xxx_t, pfunc)), "i"(XF_ ## x * sizeof(void *)) : "r11", "r2");
 #elif defined(__arm__)
 #define EXPORT_FUNC(x)                                 \
 asm volatile (                                         \
@@ -67,7 +67,7 @@ int main(void)
 #if defined(__i386__)
        xxx_t *pq;
 #elif defined(__powerpc__)
-       register volatile xxx_t *pq asm("r29");
+       register volatile xxx_t *pq asm("r2");
 #elif defined(__arm__)
        register volatile xxx_t *pq asm("r8");
 #elif defined(__mips__)
index aa6384c15249e93e8a534a6a1f6da24d65f4f239..bacd02dad05aebcbf92fd07053030412ddcaa034 100644 (file)
@@ -163,7 +163,7 @@ typedef     struct  global_data {
 #define        GD_FLG_SILENT   0x00004         /* Silent mode                          */
 
 #if 1
-#define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r29")
+#define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r2")
 #else /* We could use plain global data, but the resulting code is bigger */
 #define XTRN_DECLARE_GLOBAL_DATA_PTR   extern
 #define DECLARE_GLOBAL_DATA_PTR     XTRN_DECLARE_GLOBAL_DATA_PTR \