From: notaz Date: Sun, 25 Aug 2013 23:18:37 +0000 (+0300) Subject: famec: make reentrant X-Git-Tag: v1.85~2^2~12 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=picodrive.git;a=commitdiff_plain;h=95049eea1c93ae4ed044c0cbb51b3c19442e0e2b famec: make reentrant --- diff --git a/cpu/fame/fame.h b/cpu/fame/fame.h index f05acc7..d534924 100644 --- a/cpu/fame/fame.h +++ b/cpu/fame/fame.h @@ -122,6 +122,20 @@ typedef struct unsigned short execinfo; // PD extension int io_cycle_counter; // cycles left + + unsigned int Opcode; + signed int cycles_needed; + unsigned short *PC; + unsigned long BasePC; + unsigned int flag_C; + unsigned int flag_V; + unsigned int flag_NotZ; + unsigned int flag_N; + unsigned int flag_X; + unsigned int flag_T; + unsigned int flag_S; + unsigned int flag_I; + unsigned long Fetch[M68K_FETCHBANK1]; } M68K_CONTEXT; diff --git a/cpu/fame/famec.c b/cpu/fame/famec.c index 1aba794..6891526 100644 --- a/cpu/fame/famec.c +++ b/cpu/fame/famec.c @@ -24,7 +24,7 @@ #define FAMEC_CHECK_BRANCHES #define FAMEC_EXTRA_INLINE // #define FAMEC_DEBUG -#define FAMEC_NO_GOTOS +// #define FAMEC_NO_GOTOS #define FAMEC_ADR_BITS 24 // #define FAMEC_FETCHBITS 8 #define FAMEC_DATABITS 8 @@ -528,22 +528,20 @@ M68K_CONTEXT *g_m68kcontext; #define m68kcontext (*g_m68kcontext) #ifdef FAMEC_NO_GOTOS -static u32 Opcode; -static s32 cycles_needed; -static u16 *PC; -static uptr BasePC; -static u32 flag_C; -static u32 flag_V; -static u32 flag_NotZ; -static u32 flag_N; -static u32 flag_X; +#define Opcode m68kcontext.Opcode +#define cycles_needed m68kcontext.cycles_needed +#define PC m68kcontext.PC +#define BasePC m68kcontext.BasePC +#define flag_C m68kcontext.flag_C +#define flag_V m68kcontext.flag_V +#define flag_NotZ m68kcontext.flag_NotZ +#define flag_N m68kcontext.flag_N +#define flag_X m68kcontext.flag_X #endif -#ifdef FAMEC_EMULATE_TRACE -static u32 flag_T; -#endif -static u32 flag_S; -static u32 flag_I; +#define flag_T m68kcontext.flag_T +#define flag_S m68kcontext.flag_S +#define flag_I m68kcontext.flag_I static u32 initialised = 0;