]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - examples/stubs.c
Merge branch 'master' of /home/wd/git/u-boot/custodians
[karo-tx-uboot.git] / examples / stubs.c
index 1797274eb4e42c06ec988b938e986264bc8d1e9d..ec5353216b54983aa95a996def7597945cc888c0 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"                         \
@@ -92,7 +92,7 @@ gd_t *global_data;
 #x ":\n"                               \
 "      movhi   r8, %%hi(%0)\n"         \
 "      ori     r8, r0, %%lo(%0)\n"     \
-"      add     r8, r0, r15\n"          \
+"      add     r8, r8, r15\n"          \
 "      ldw     r8, 0(r8)\n"            \
 "      ldw     r8, %1(r8)\n"           \
 "      jmp     r8\n"                   \
@@ -131,13 +131,58 @@ gd_t *global_data;
  * register
  */
 #define EXPORT_FUNC(x)                 \
-        asm volatile (                 \
-"       .globl " #x "\n"               \
+       asm volatile (                  \
+"      .globl _" #x "\n_"              \
 #x ":\n"                               \
 "      P0 = [P5 + %0]\n"               \
 "      P0 = [P0 + %1]\n"               \
 "      JUMP (P0)\n"                    \
        : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "P0");
+#elif defined(CONFIG_AVR32)
+/*
+ * r6 holds the pointer to the global_data. r8 is call clobbered.
+ */
+#define EXPORT_FUNC(x)                                 \
+       asm volatile(                                   \
+               "       .globl\t" #x "\n"               \
+               #x ":\n"                                \
+               "       ld.w    r8, r6[%0]\n"           \
+               "       ld.w    pc, r8[%1]\n"           \
+               :                                       \
+               : "i"(offsetof(gd_t, jt)), "i"(XF_ ##x) \
+               : "r8");
+#elif defined(CONFIG_SH)
+/*
+ * r13 holds the pointer to the global_data. r1 is a call clobbered.
+ */
+#define EXPORT_FUNC(x)                                 \
+       asm volatile (                                  \
+               "       .align  2\n"                    \
+               "       .globl " #x "\n"                \
+               #x ":\n"                                \
+               "       mov     r13, r1\n"              \
+               "       add     %0, r1\n"               \
+               "       add     %1, r1\n"               \
+               "       jmp     @r1\n"                  \
+               "       nop\n"                          \
+               "       nop\n"                          \
+               : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r1");
+#elif defined(CONFIG_SPARC)
+/*
+ * g7 holds the pointer to the global_data. g1 is call clobbered.
+ */
+#define EXPORT_FUNC(x)                                 \
+       asm volatile(                                   \
+"      .globl\t" #x "\n"                               \
+#x ":\n"                                               \
+"      set %0, %%g1\n"                                 \
+"      or %%g1, %%g7, %%g1\n"                          \
+"      ld [%%g1], %%g1\n"                              \
+"      ld [%%g1 + %1], %%g1\n"                         \
+"      call %%g1\n"                                    \
+"      nop\n"                                          \
+       : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x) : "g1" );
+
 #else
 #error stubs definition missing for this architecture
 #endif
@@ -161,10 +206,10 @@ extern unsigned long __bss_start, _end;
 
 void app_startup(char **argv)
 {
-       unsigned long * cp = &__bss_start;
+       unsigned char * cp = (unsigned char *) &__bss_start;
 
        /* Zero out BSS */
-       while (cp < &_end) {
+       while (cp < (unsigned char *)&_end) {
                *cp++ = 0;
        }