From a1a6da9a22d717ffba168ee49ebe60dbab2e3a59 Mon Sep 17 00:00:00 2001 From: beeanyew Date: Mon, 30 Aug 2021 23:57:45 +0200 Subject: [PATCH] Fix Musashi compilation with trace emulation enabled --- emulator.c | 2 +- m68kcpu.c | 5 +---- m68kcpu.h | 10 ++++------ 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/emulator.c b/emulator.c index d975002..6137910 100644 --- a/emulator.c +++ b/emulator.c @@ -251,7 +251,7 @@ static inline void m68k_execute_bef(m68ki_cpu_core *state, int num_cycles) USE_CYCLES(CYC_INSTRUCTION[REG_IR]); /* Trace m68k_exception, if necessary */ - m68ki_exception_if_trace(); /* auto-disable (see m68kcpu.h) */ + m68ki_exception_if_trace(state); /* auto-disable (see m68kcpu.h) */ } while(GET_CYCLES() > 0); /* set previous PC to current PC for the next entry into the loop */ diff --git a/m68kcpu.c b/m68kcpu.c index b88eaa5..e4e1380 100644 --- a/m68kcpu.c +++ b/m68kcpu.c @@ -1019,7 +1019,7 @@ int m68k_execute(m68ki_cpu_core *state, int num_cycles) USE_CYCLES(CYC_INSTRUCTION[REG_IR]); /* Trace m68k_exception, if necessary */ - m68ki_exception_if_trace(); /* auto-disable (see m68kcpu.h) */ + m68ki_exception_if_trace(state); /* auto-disable (see m68kcpu.h) */ } while(GET_CYCLES() > 0); /* set previous PC to current PC for the next entry into the loop */ @@ -1259,7 +1259,6 @@ inline unsigned int m68k_read_pcrelative_32(m68ki_cpu_core *state, unsigned int } #endif - uint m68ki_read_imm16_addr_slowpath(m68ki_cpu_core *state, uint32_t pc, address_translation_cache *cache) { uint32_t address = ADDRESS_68K(pc); @@ -1306,8 +1305,6 @@ uint m68ki_read_imm16_addr_slowpath(m68ki_cpu_core *state, uint32_t pc, address_ #endif /* M68K_EMULATE_PREFETCH */ } - - void m68k_add_ram_range(uint32_t addr, uint32_t upper, unsigned char *ptr) { m68ki_cpu.code_translation_cache.lower = 0; diff --git a/m68kcpu.h b/m68kcpu.h index a15a958..cdb7930 100644 --- a/m68kcpu.h +++ b/m68kcpu.h @@ -603,12 +603,12 @@ typedef uint32 uint64; /* Clear all tracing */ #define m68ki_clear_trace() m68ki_tracing = 0 /* Cause a trace exception if we are tracing */ - #define m68ki_exception_if_trace() if(m68ki_tracing) m68ki_exception_trace() + #define m68ki_exception_if_trace(a) if(m68ki_tracing) m68ki_exception_trace(a) #else #define m68ki_trace_t1() #define m68ki_trace_t0() #define m68ki_clear_trace() - #define m68ki_exception_if_trace() + #define m68ki_exception_if_trace(...) #endif /* M68K_EMULATE_TRACE */ @@ -1172,8 +1172,6 @@ static inline uint32 m68ki_ic_readimm16(m68ki_cpu_core *state, uint32 address) */ uint m68ki_read_imm16_addr_slowpath(m68ki_cpu_core *state, uint32_t pc, address_translation_cache *cache); - - static inline uint m68ki_read_imm_16(m68ki_cpu_core *state) { uint32_t pc = REG_PC; @@ -1329,7 +1327,7 @@ static inline uint m68ki_read_16_fc(m68ki_cpu_core *state, uint address, uint fc if (address & 0x01) { return ((ps_read_8(address) << 8) | ps_read_8(address + 1)); } - return ps_read_16_ex(state->gpio, address); + return ps_read_16(address); } #endif @@ -1371,7 +1369,7 @@ static inline uint m68ki_read_32_fc(m68ki_cpu_core *state, uint address, uint fc c |= (ps_read_8(address + 3) << 24); return htobe32(c); } - return ps_read_32_ex(state->gpio, address); + return ps_read_32(address); } #endif