summaryrefslogtreecommitdiff
path: root/examples/standalone/stubs.c
diff options
context:
space:
mode:
authorMacpaul Lin <macpaul@andestech.com>2011-10-11 22:33:20 +0000
committerWolfgang Denk <wd@denx.de>2011-10-22 00:53:48 +0200
commit72c73ddec3d50776fda2fcd92854f0d9fc9d4a33 (patch)
treeb6884d2e3f5870552bd74d6181df17d4ce72a94d /examples/standalone/stubs.c
parent463d47f66ce19aac043d98d77a958908e2a3eb39 (diff)
nds32: standalone support
Add standalone program related support for nds32 architecture. Signed-off-by: Macpaul Lin <macpaul@andestech.com>
Diffstat (limited to 'examples/standalone/stubs.c')
-rw-r--r--examples/standalone/stubs.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/examples/standalone/stubs.c b/examples/standalone/stubs.c
index 507d38ceaf9..11c756525ae 100644
--- a/examples/standalone/stubs.c
+++ b/examples/standalone/stubs.c
@@ -167,8 +167,23 @@ gd_t *global_data;
" jmp %%g1\n" \
" nop\n" \
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "g1" );
-
+#elif defined(CONFIG_NDS32)
+/*
+ * r16 holds the pointer to the global_data. gp is call clobbered.
+ * not support reduced register (16 GPR).
+ */
+#define EXPORT_FUNC(x) \
+ asm volatile ( \
+" .globl " #x "\n" \
+#x ":\n" \
+" lwi $r16, [$gp + (%0)]\n" \
+" lwi $r16, [$r16 + (%1)]\n" \
+" jr $r16\n" \
+ : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "$r16");
#else
+/*" addi $sp, $sp, -24\n" \
+" br $r16\n" \*/
+
#error stubs definition missing for this architecture
#endif