common/cmd_[i-z]* : Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).
[oweals/u-boot.git] / examples / stubs.c
index c3d2a77a8289da46a00ef020abe15ce899c81ba2..26df6e06a15ea58d8853fbbcd30ce3b14002581e 100644 (file)
@@ -82,6 +82,21 @@ gd_t *global_data;
 "      jmp     %%g0\n"                 \
 "      nop     \n"                     \
        : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x) : "r0");
+#elif defined(CONFIG_NIOS2)
+/*
+ * r15 holds the pointer to the global_data, r8 is call-clobbered
+ */
+#define EXPORT_FUNC(x) \
+       asm volatile (                  \
+"      .globl " #x "\n"                \
+#x ":\n"                               \
+"      movhi   r8, %%hi(%0)\n"         \
+"      ori     r8, r0, %%lo(%0)\n"     \
+"      add     r8, r8, r15\n"          \
+"      ldw     r8, 0(r8)\n"            \
+"      ldw     r8, %1(r8)\n"           \
+"      jmp     r8\n"                   \
+       : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r15");
 #elif defined(CONFIG_M68K)
 /*
  * d7 holds the pointer to the global_data, a0 is a call-clobbered
@@ -110,6 +125,32 @@ gd_t *global_data;
 "      lwi     r5, r5, %1\n"                   \
 "      bra     r5\n"                           \
        : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r5");
+#elif defined(CONFIG_BLACKFIN)
+/*
+ * P5 holds the pointer to the global_data, P0 is a call-clobbered
+ * register
+ */
+#define EXPORT_FUNC(x)                 \
+       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