diff --git a/BaS_gcc/include/xhdi_sd.h b/BaS_gcc/include/xhdi_sd.h index 0ec5820..dbe42b5 100644 --- a/BaS_gcc/include/xhdi_sd.h +++ b/BaS_gcc/include/xhdi_sd.h @@ -53,7 +53,7 @@ /* * FIXME: dangerous TRAP here! * - * all of these functions get compiled with "normal" GCC integers (32 bit). However, since they will be called + * all of these functions get compiled into BaS with "normal" GCC integers (32 bit). However, since they will be called * from code compiled with -mshort, integers must be declared uint32_t for those compilation units to adhere * to "normal" GCC calling conventions. * @@ -67,8 +67,13 @@ #define UINT16_T uint16_t #endif +/* a riddle: how do you typedef a function pointer to a function that returns its own type? ;) */ +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 uint32_t xhdi_version(void); /* XHDI 0 */ extern uint32_t xhdi_inquire_target(UINT16_T major, UINT16_T minor, uint32_t *block_size, uint32_t *flags, diff --git a/BaS_gcc/sources/xhdi_sd.c b/BaS_gcc/sources/xhdi_sd.c index 687c867..a13d346 100644 --- a/BaS_gcc/sources/xhdi_sd.c +++ b/BaS_gcc/sources/xhdi_sd.c @@ -12,6 +12,14 @@ #define DRIVER_VERSION 0x130 +static xhdi_call_fun old_vector = NULL; + +__attribute__((__interrupt__)) void *xhdi_sd_install(xhdi_call_fun ov) +{ + old_vector = ov; + return (void *) xhdi_call; +} + uint32_t xhdi_version(void) { return DRIVER_VERSION;