common/cmd_[i-z]* : Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).
[oweals/u-boot.git] / examples / stubs.c
index 1caa575747992c613ad8e7b9d24f697561b43934..26df6e06a15ea58d8853fbbcd30ce3b14002581e 100644 (file)
@@ -132,12 +132,25 @@ gd_t *global_data;
  */
 #define EXPORT_FUNC(x)                 \
        asm volatile (                  \
-"       .globl " #x "\n"               \
+"       .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