efi_loader: type of efi_secure_mode
[oweals/u-boot.git] / examples / standalone / stubs.c
index f7c973432ec9813741fa73f0696fba9afdcb9d22..5fb460454f23a9d629efeca5a7a78a78701893fb 100644 (file)
@@ -2,6 +2,8 @@
 #include <exports.h>
 #include <linux/compiler.h>
 
+struct cmd_tbl;
+
 #define FO(x) offsetof(struct jt_funcs, x)
 
 #if defined(CONFIG_X86)
@@ -141,19 +143,6 @@ gd_t *global_data;
 "      lwi     r5, r5, %1\n"                   \
 "      bra     r5\n"                           \
        : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "r5");
-#elif defined(CONFIG_AVR32)
-/*
- * r6 holds the pointer to the global_data. r8 is call clobbered.
- */
-#define EXPORT_FUNC(f, a, 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"(FO(x))   \
-               : "r8");
 #elif defined(CONFIG_SH)
 /*
  * r13 holds the pointer to the global_data. r1 is a call clobbered.
@@ -172,21 +161,6 @@ gd_t *global_data;
                "       nop\n"                          \
                "       nop\n"                          \
                : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "r1", "r2");
-#elif defined(CONFIG_SPARC)
-/*
- * g7 holds the pointer to the global_data. g1 is call clobbered.
- */
-#define EXPORT_FUNC(f, a, 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"                         \
-"      jmp %%g1\n"                                     \
-"      nop\n"                                          \
-       : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "g1");
 #elif defined(CONFIG_NDS32)
 /*
  * r16 holds the pointer to the global_data. gp is call clobbered.
@@ -200,20 +174,29 @@ gd_t *global_data;
 "      lwi     $r16, [$r16 + (%1)]\n"  \
 "      jr      $r16\n"                 \
        : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "$r16");
-#elif defined(CONFIG_OPENRISC)
+#elif defined(CONFIG_RISCV)
 /*
- * r10 holds the pointer to the global_data, r13 is a call-clobbered
- * register
+ * gp holds the pointer to the global_data. t0 is call clobbered.
  */
-#define EXPORT_FUNC(f, a, x, ...) \
+#ifdef CONFIG_ARCH_RV64I
+#define EXPORT_FUNC(f, a, x, ...)      \
+       asm volatile (                  \
+"      .globl " #x "\n"                \
+#x ":\n"                               \
+"      ld      t0, %0(gp)\n"           \
+"      ld      t0, %1(t0)\n"           \
+"      jr      t0\n"                   \
+       : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "t0");
+#else
+#define EXPORT_FUNC(f, a, x, ...)      \
        asm volatile (                  \
 "      .globl " #x "\n"                \
 #x ":\n"                               \
-"      l.lwz   r13, %0(r10)\n" \
-"      l.lwz   r13, %1(r13)\n" \
-"      l.jr    r13\n"          \
-"      l.nop\n"                                \
-       : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "r13");
+"      lw      t0, %0(gp)\n"           \
+"      lw      t0, %1(t0)\n"           \
+"      jr      t0\n"                   \
+       : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "t0");
+#endif
 #elif defined(CONFIG_ARC)
 /*
  * r25 holds the pointer to the global_data. r10 is call clobbered.