Patches by Scott McNutt, 24 Aug 2004:
- Add support for Altera Nios-II processors.
- Add support for Psyent PCI-5441 board.
- Add support for Psyent PK1C20 board.
diff --git a/examples/stubs.c b/examples/stubs.c
index c3d2a77..d4c6e06 100644
--- a/examples/stubs.c
+++ b/examples/stubs.c
@@ -82,6 +82,21 @@
 "	jmp	%%g0\n"			\
 "	nop	\n"			\
 	: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x) : "r0");
+#elif defined(CONFIG_NIOS2)
+/*
+ * r15 holds the pointer to the global_data, r8 is call-clobbered
+ */
+#define EXPORT_FUNC(x) \
+	asm volatile (			\
+"	.globl " #x "\n"		\
+#x ":\n"				\
+"	movhi	r8, %%hi(%0)\n"		\
+"	ori	r8, r0, %%lo(%0)\n"	\
+"	add	r8, r0, r15\n"		\
+"	ldw	r8, 0(r8)\n"		\
+"	ldw	r8, %1(r8)\n"		\
+"	jmp	r8\n"			\
+	: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r15");
 #elif defined(CONFIG_M68K)
 /*
  * d7 holds the pointer to the global_data, a0 is a call-clobbered