--- uae/src/include/compiler.h 2018/04/24 16:38:39 1.1 +++ uae/src/include/compiler.h 2018/04/24 16:40:17 1.1.1.3 @@ -1,16 +1,16 @@ - /* + /* * UAE - The Un*x Amiga Emulator - * + * * m68k -> i386 compiler * * (c) 1995 Bernd Schmidt */ -typedef CPTR (*code_execfunc)(void); +typedef uaecptr (*code_execfunc)(void); struct code_page { struct code_page *next; - ULONG allocmask; + uae_u32 allocmask; }; struct hash_block { @@ -19,9 +19,9 @@ struct hash_block { struct code_page *cpage; int alloclen; - ULONG page_allocmask; + uae_u32 page_allocmask; char *compile_start; - + int nrefs; int translated:1; @@ -30,28 +30,29 @@ struct hash_block { }; struct hash_entry { + code_execfunc execute; /* For the sake of the stubs in X86.S */ struct hash_entry *next,*prev; struct hash_entry *next_same_block, *lru_next, *lru_prev; struct hash_block *block; - - code_execfunc execute; - CPTR addr; - ULONG matchword; + + uaecptr addr; + uae_u32 matchword; int ncalls:8; int locked:1; int cacheflush:1; }; extern int nr_bbs_start; -extern UBYTE nr_bbs_to_run; +extern uae_u8 nr_bbs_to_run; extern code_execfunc exec_me; #ifdef USE_COMPILER static __inline__ void run_compiled_code(void) { - if (regs.spcflags == SPCFLAG_EXEC) { + + /*if (regs.spcflags == SPCFLAG_EXEC && may_run_compiled) {*/ while (regs.spcflags == SPCFLAG_EXEC) { - CPTR newpc; + uaecptr newpc; regs.spcflags = 0; /* newpc = (*exec_me)();*/ __asm__ __volatile__ ("pushl %%ebp; call *%1; popl %%ebp" : "=a" (newpc) : "r" (exec_me) : @@ -68,25 +69,43 @@ static __inline__ void run_compiled_code m68k_setpc_fast(newpc); do_cycles(); } - } else +/*} else */ regs.spcflags &= ~SPCFLAG_EXEC; } extern void compiler_init(void); extern void possible_loadseg(void); +extern void m68k_do_rts(void); +extern void m68k_do_bsr(uaecptr, uae_s32); +extern void m68k_do_jsr(uaecptr, uaecptr); +extern void compiler_flush_jsr_stack(void); + #else -static __inline__ void run_compiled_code(void) +#define run_compiled_code() do { ; } while (0) +#define compiler_init() do { ; } while (0) +#define possible_loadseg() do { ; } while (0) +#define compiler_flush_jsr_stack() do { ; } while (0) + +static __inline__ void m68k_do_rts(void) { + m68k_setpc(get_long(m68k_areg(regs, 7))); + m68k_areg(regs, 7) += 4; } -static __inline__ void compiler_init(void) +static __inline__ void m68k_do_bsr(uaecptr oldpc, uae_s32 offset) { + m68k_areg(regs, 7) -= 4; + put_long(m68k_areg(regs, 7), oldpc); + m68k_incpc(offset); } -static __inline__ void possible_loadseg(void) +static __inline__ void m68k_do_jsr(uaecptr oldpc, uaecptr dest) { + m68k_areg(regs, 7) -= 4; + put_long(m68k_areg(regs, 7), oldpc); + m68k_setpc(dest); } #endif