diff options
Diffstat (limited to 'examples/stubs.c')
-rw-r--r-- | examples/stubs.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/stubs.c b/examples/stubs.c index c3d2a77a828..d4c6e063e3e 100644 --- a/examples/stubs.c +++ b/examples/stubs.c @@ -82,6 +82,21 @@ gd_t *global_data; " 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 |