From 839277710ae9146921be814d2bfb64f030ec2f50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Wed, 1 May 2013 16:30:15 +0000 Subject: [PATCH] fixed vector bending (very ugly) --- include/xhdi_sd.h | 2 +- sources/xhdi_sd.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/xhdi_sd.h b/include/xhdi_sd.h index dbe42b5..fa87f37 100644 --- a/include/xhdi_sd.h +++ b/include/xhdi_sd.h @@ -72,7 +72,7 @@ typedef void* (*xhdi_call_fun)(int xhdi_fun, ...); extern uint32_t xhdi_call(int xhdi_fun, ...); -extern void *xhdi_sd_install(xhdi_call_fun old_vector) __attribute__((__interrupt__)); +extern xhdi_call_fun xhdi_sd_install(xhdi_call_fun old_vector) __attribute__((__interrupt__)); extern uint32_t xhdi_version(void); /* XHDI 0 */ diff --git a/sources/xhdi_sd.c b/sources/xhdi_sd.c index a13d346..a5be9cb 100644 --- a/sources/xhdi_sd.c +++ b/sources/xhdi_sd.c @@ -14,10 +14,17 @@ static xhdi_call_fun old_vector = NULL; -__attribute__((__interrupt__)) void *xhdi_sd_install(xhdi_call_fun ov) +__attribute__((__interrupt__)) xhdi_call_fun xhdi_sd_install(xhdi_call_fun ov) { old_vector = ov; - return (void *) xhdi_call; + /* THIS does not work: return (xhdi_call_fun) &xhdi_call; */ + __asm__ __volatile__ ( + "move.l %[xhdi_call],d1\n\t" + "move.l d1,(sp)\n\t" + : /* output */ + : [xhdi_call]"g"(xhdi_call) + : "d1","memory"); + return (xhdi_call_fun) xhdi_call; } uint32_t xhdi_version(void)