summaryrefslogtreecommitdiff
path: root/examples/standalone
diff options
context:
space:
mode:
authorLukas Auer <lukas.auer@aisec.fraunhofer.de>2019-01-04 01:37:33 +0100
committerAndes <uboot@andestech.com>2019-01-15 09:36:31 +0800
commit7eb792970e3af4aa0c99a972411f239b0fc03a63 (patch)
tree716477d1f158c8900487df3e52f77c5ac6fb2231 /examples/standalone
parentcbb860f2c89c05c4c1d571f61bb76650db489d7d (diff)
downloadu-boot-7eb792970e3af4aa0c99a972411f239b0fc03a63.tar.gz
u-boot-7eb792970e3af4aa0c99a972411f239b0fc03a63.tar.bz2
u-boot-7eb792970e3af4aa0c99a972411f239b0fc03a63.zip
riscv: support standalone applications on RV64I systems
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>
Diffstat (limited to 'examples/standalone')
-rw-r--r--examples/standalone/stubs.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/standalone/stubs.c b/examples/standalone/stubs.c
index f37d209da6..0827bde35e 100644
--- a/examples/standalone/stubs.c
+++ b/examples/standalone/stubs.c
@@ -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.