summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile5
-rw-r--r--examples/stubs.c18
2 files changed, 22 insertions, 1 deletions
diff --git a/examples/Makefile b/examples/Makefile
index e9b4974..71a8c7f 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -61,6 +61,11 @@ ifeq ($(ARCH),avr32)
LOAD_ADDR = 0x00000000
endif
+ifeq ($(ARCH),sh)
+LOAD_ADDR = 0x8C000000
+endif
+
+
include $(TOPDIR)/config.mk
ELF = hello_world
diff --git a/examples/stubs.c b/examples/stubs.c
index 26df6e0..571c4d5 100644
--- a/examples/stubs.c
+++ b/examples/stubs.c
@@ -132,7 +132,7 @@ gd_t *global_data;
*/
#define EXPORT_FUNC(x) \
asm volatile ( \
-" .globl _" #x "\n_" \
+" .globl _" #x "\n_" \
#x ":\n" \
" P0 = [P5 + %0]\n" \
" P0 = [P0 + %1]\n" \
@@ -151,6 +151,22 @@ gd_t *global_data;
: \
: "i"(offsetof(gd_t, jt)), "i"(XF_ ##x) \
: "r8");
+#elif defined(CONFIG_SH)
+/*
+ * r13 holds the pointer to the global_data. r1 is a call clobbered.
+ */
+#define EXPORT_FUNC(x) \
+ asm volatile ( \
+ " .align 2\n" \
+ " .globl " #x "\n" \
+ #x ":\n" \
+ " mov r13, r1\n" \
+ " add %0, r1\n" \
+ " add %1, r1\n" \
+ " jmp @r1\n" \
+ " nop\n" \
+ " nop\n" \
+ : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r1");
#else
#error stubs definition missing for this architecture
#endif