]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
riscv: support standalone applications on RV64I systems
authorLukas Auer <lukas.auer@aisec.fraunhofer.de>
Fri, 4 Jan 2019 00:37:33 +0000 (01:37 +0100)
committerAndes <uboot@andestech.com>
Tue, 15 Jan 2019 01:36:31 +0000 (09:36 +0800)
Add an implementation of EXPORT_FUNC() for RV64I systems to support them
in standalone applications.

Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
examples/standalone/stubs.c

index f37d209da6db2b731b06a581a8a92886a0a6af36..0827bde35e581b27b9b7d081fef35ae296c4f698 100644 (file)
@@ -176,6 +176,16 @@ gd_t *global_data;
 /*
  * gp holds the pointer to the global_data. t0 is call clobbered.
  */
+#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"                \
@@ -184,6 +194,7 @@ gd_t *global_data;
 "      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.