openrisc: Add support for standalone programs
authorStefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Fri, 18 Nov 2011 19:21:35 +0000 (19:21 +0000)
committerWolfgang Denk <wd@denx.de>
Fri, 13 Jan 2012 20:16:55 +0000 (21:16 +0100)
Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
examples/standalone/stubs.c

index a6add6abcd4c433f1a580a976b3b7a973ec87cc1..15e9afcacd0904da1003e1aec88820f2c8281a31 100644 (file)
@@ -181,6 +181,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"                 \*/