This commit is contained in:
Markus Fröschle
2013-05-03 19:24:34 +00:00
parent dc048978b5
commit 9ca54ea56d
2 changed files with 12 additions and 10 deletions

View File

@@ -15,7 +15,7 @@ static uint32_t cookieptr(void)
int getcookie(uint32_t cookie, uint32_t *p_value)
{
uint32_t *cookiejar = (long *) Supexec(cookieptr);
uint32_t *cookiejar = (uint32_t *) Supexec(cookieptr);
if (!cookiejar) return 0;

View File

@@ -13,6 +13,8 @@
#include <stdio.h>
#include <osbind.h>
//#include "cookie.h"
#define XHDIMAGIC 0x27011992L
typedef uint32_t (*cookie_fun)(uint16_t opcode,...);
@@ -21,39 +23,39 @@ static cookie_fun old_vector = NULL;
static cookie_fun get_fun_ptr(void)
{
static cookie_fun XHDI = NULL;
static cookie_fun xhdi = NULL;
static int have_it = 0;
if (!have_it)
{
uint32_t *magic_test;
getcookie ('XHDI', (uint32_t *) &XHDI);
getcookie ('XHDI', (uint32_t *) &xhdi);
have_it = 1;
/* check magic */
magic_test = (uint32_t *)XHDI;
magic_test = (uint32_t *) xhdi;
if (magic_test && (magic_test[-1] != XHDIMAGIC))
XHDI = NULL;
xhdi = NULL;
}
return XHDI;
return xhdi;
}
__extension__ cookie_fun bas_sd_vector(cookie_fun old_vector)
cookie_fun bas_sd_vector(cookie_fun old_vector)
{
register long retvalue __asm__("d0");
__asm__ __volatile(
"move.l %1,-(sp)\n\t"
"move.l %[retvalue],-(sp)\n\t"
"trap #0\n\t"
"addq.l #4,sp\n\t"
: "=r"(retvalue)
: [retvalue]"=r"(retvalue)
: "g"(old_vector)
:
);
retvalue;
return retvalue;
}
int main(int argc, char *argv[])