]> git.sur5r.net Git - u-boot/blobdiff - examples/stubs.c
Merge with git+ssh://sr@pollux.denx.org/home/sr/git/u-boot/denx/.git
[u-boot] / examples / stubs.c
index 1797274eb4e42c06ec988b938e986264bc8d1e9d..ffd314e6b35c9985799b7ca8b5489484ec85d9fc 100644 (file)
@@ -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,26 @@ gd_t *global_data;
  * register
  */
 #define EXPORT_FUNC(x)                 \
-        asm volatile (                 \
+       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");
 #else
 #error stubs definition missing for this architecture
 #endif