Patchwork [U-Boot,6/9] openrisc: Add support for standalone programs

login
register
mail settings
Submitter Stefan Kristiansson
Date Nov. 19, 2011, 5:21 a.m.
Message ID <1321680098-31121-7-git-send-email-stefan.kristiansson@saunalahti.fi>
Download mbox | patch
Permalink /patch/126524/
State Accepted
Commit 3553493d8b4e402a737b80b04fab06f6e81bcb69
Headers show

Comments

Stefan Kristiansson - Nov. 19, 2011, 5:21 a.m.
Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
---
 examples/standalone/stubs.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

Patch

diff --git a/examples/standalone/stubs.c b/examples/standalone/stubs.c
index 11c7565..8b291db 100644
--- a/examples/standalone/stubs.c
+++ b/examples/standalone/stubs.c
@@ -180,6 +180,20 @@  gd_t *global_data;
 "	lwi	$r16, [$r16 + (%1)]\n"	\
 "	jr	$r16\n"			\
 	: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "$r16");
+#elif defined(CONFIG_OPENRISC)
+/*
+ * r10 holds the pointer to the global_data, r13 is a call-clobbered
+ * register
+ */
+#define EXPORT_FUNC(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"(XF_ ## x * sizeof(void *)) : "r13");
 #else
 /*"	addi	$sp, $sp, -24\n"	\
 "	br	$r16\n"			\*/