implemented function to initialize driver hook

This commit is contained in:
Markus Fröschle
2013-05-01 14:15:25 +00:00
parent 935106ada6
commit 2b34bec3cc
2 changed files with 14 additions and 1 deletions

View File

@@ -53,7 +53,7 @@
/* /*
* FIXME: dangerous TRAP here! * 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 * from code compiled with -mshort, integers must be declared uint32_t for those compilation units to adhere
* to "normal" GCC calling conventions. * to "normal" GCC calling conventions.
* *
@@ -67,8 +67,13 @@
#define UINT16_T uint16_t #define UINT16_T uint16_t
#endif #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 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_version(void); /* XHDI 0 */
extern uint32_t xhdi_inquire_target(UINT16_T major, UINT16_T minor, uint32_t *block_size, uint32_t *flags, extern uint32_t xhdi_inquire_target(UINT16_T major, UINT16_T minor, uint32_t *block_size, uint32_t *flags,

View File

@@ -12,6 +12,14 @@
#define DRIVER_VERSION 0x130 #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) uint32_t xhdi_version(void)
{ {
return DRIVER_VERSION; return DRIVER_VERSION;