diff options
Diffstat (limited to 'src/emu/cpu/sh2')
-rw-r--r-- | src/emu/cpu/sh2/sh2.c | 9 | ||||
-rw-r--r-- | src/emu/cpu/sh2/sh2.h | 7 | ||||
-rw-r--r-- | src/emu/cpu/sh2/sh2comn.c | 34 | ||||
-rw-r--r-- | src/emu/cpu/sh2/sh2comn.h | 10 | ||||
-rw-r--r-- | src/emu/cpu/sh2/sh2drc.c | 142 | ||||
-rw-r--r-- | src/emu/cpu/sh2/sh2fe.c | 30 |
6 files changed, 117 insertions, 115 deletions
diff --git a/src/emu/cpu/sh2/sh2.c b/src/emu/cpu/sh2/sh2.c index 1bacc091a98..d24b9277e38 100644 --- a/src/emu/cpu/sh2/sh2.c +++ b/src/emu/cpu/sh2/sh2.c @@ -116,7 +116,7 @@ CPU_DISASSEMBLE( sh2 ); #define LOG(x) do { if (VERBOSE) logerror x; } while (0) static int sh2_icount; -SH2 *sh2; +sh2_state *sh2; INLINE UINT8 RB(offs_t A) { @@ -2154,7 +2154,7 @@ static CPU_RESET( sh2 ) save_is_slave = sh2->is_slave; dma_callback_kludge = sh2->dma_callback_kludge; - memset(sh2, 0, sizeof(SH2)); + memset(sh2, 0, sizeof(sh2_state)); sh2->dma_callback_kludge = dma_callback_kludge; sh2->is_slave = save_is_slave; @@ -2318,7 +2318,7 @@ CPU_GET_INFO( sh2 ) switch (state) { /* --- the following bits of info are returned as 64-bit signed integers --- */ - case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(SH2); break; + case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(sh2_state); break; case CPUINFO_INT_INPUT_LINES: info->i = 16; break; case CPUINFO_INT_DEFAULT_IRQ_VECTOR: info->i = 0; break; case DEVINFO_INT_ENDIANNESS: info->i = ENDIANNESS_BIG; break; @@ -2464,4 +2464,7 @@ void sh2drc_add_pcflush(running_device *device, offs_t address) /* doesn't apply here */ } +DEFINE_LEGACY_CPU_DEVICE(SH1, sh1); +DEFINE_LEGACY_CPU_DEVICE(SH2, sh2); + #endif diff --git a/src/emu/cpu/sh2/sh2.h b/src/emu/cpu/sh2/sh2.h index 792147ddeb2..fd93257fec3 100644 --- a/src/emu/cpu/sh2/sh2.h +++ b/src/emu/cpu/sh2/sh2.h @@ -64,11 +64,8 @@ struct _sh2_cpu_core int (*dma_callback_kludge)(UINT32 src, UINT32 dst, UINT32 data, int size); }; -extern CPU_GET_INFO( sh1 ); -extern CPU_GET_INFO( sh2 ); - -#define CPU_SH1 CPU_GET_INFO_NAME( sh1 ) -#define CPU_SH2 CPU_GET_INFO_NAME( sh2 ) +DECLARE_LEGACY_CPU_DEVICE(SH1, sh1); +DECLARE_LEGACY_CPU_DEVICE(SH2, sh2); WRITE32_HANDLER( sh2_internal_w ); READ32_HANDLER( sh2_internal_r ); diff --git a/src/emu/cpu/sh2/sh2comn.c b/src/emu/cpu/sh2/sh2comn.c index 94f95085f7a..a40b3bc4876 100644 --- a/src/emu/cpu/sh2/sh2comn.c +++ b/src/emu/cpu/sh2/sh2comn.c @@ -16,15 +16,15 @@ #define LOG(x) do { if (VERBOSE) logerror x; } while (0) #ifdef USE_SH2DRC -#define GET_SH2(dev) *(SH2 **)downcast<legacy_cpu_device *>(dev)->token() +#define GET_SH2(dev) *(sh2_state **)downcast<legacy_cpu_device *>(dev)->token() #else -#define GET_SH2(dev) (SH2 *)downcast<legacy_cpu_device *>(dev)->token() +#define GET_SH2(dev) (sh2_state *)downcast<legacy_cpu_device *>(dev)->token() #endif static const int div_tab[4] = { 3, 5, 7, 0 }; -INLINE UINT32 RL(SH2 *sh2, offs_t A) +INLINE UINT32 RL(sh2_state *sh2, offs_t A) { if (A >= 0xe0000000) return sh2_internal_r(sh2->internal, (A & 0x1fc)>>2, 0xffffffff); @@ -38,7 +38,7 @@ INLINE UINT32 RL(SH2 *sh2, offs_t A) return memory_read_dword_32be(sh2->program, A & AM); } -INLINE void WL(SH2 *sh2, offs_t A, UINT32 V) +INLINE void WL(sh2_state *sh2, offs_t A, UINT32 V) { if (A >= 0xe0000000) { @@ -58,7 +58,7 @@ INLINE void WL(SH2 *sh2, offs_t A, UINT32 V) memory_write_dword_32be(sh2->program, A & AM,V); } -static void sh2_timer_resync(SH2 *sh2) +static void sh2_timer_resync(sh2_state *sh2) { int divider = div_tab[(sh2->m[5] >> 8) & 3]; UINT64 cur_time = sh2->device->total_cycles(); @@ -68,7 +68,7 @@ static void sh2_timer_resync(SH2 *sh2) sh2->frc_base = cur_time; } -static void sh2_timer_activate(SH2 *sh2) +static void sh2_timer_activate(sh2_state *sh2) { int max_delta = 0xfffff; UINT16 frc; @@ -108,7 +108,7 @@ static void sh2_timer_activate(SH2 *sh2) static TIMER_CALLBACK( sh2_timer_callback ) { - SH2 *sh2 = (SH2 *)ptr; + sh2_state *sh2 = (sh2_state *)ptr; UINT16 frc; sh2_timer_resync(sh2); @@ -136,7 +136,7 @@ static TIMER_CALLBACK( sh2_timer_callback ) static TIMER_CALLBACK( sh2_dmac_callback ) { int dma = param & 1; - SH2 *sh2 = (SH2 *)ptr; + sh2_state *sh2 = (sh2_state *)ptr; LOG(("SH2.%s: DMA %d complete\n", sh2->device->tag(), dma)); sh2->m[0x63+4*dma] |= 2; @@ -144,7 +144,7 @@ static TIMER_CALLBACK( sh2_dmac_callback ) sh2_recalc_irq(sh2); } -static void sh2_dmac_check(SH2 *sh2, int dma) +static void sh2_dmac_check(sh2_state *sh2, int dma) { if(sh2->m[0x63+4*dma] & sh2->m[0x6c] & 1) { @@ -284,7 +284,7 @@ static void sh2_dmac_check(SH2 *sh2, int dma) WRITE32_HANDLER( sh2_internal_w ) { - SH2 *sh2 = GET_SH2(space->cpu); + sh2_state *sh2 = GET_SH2(space->cpu); UINT32 old; #ifdef USE_SH2DRC @@ -462,7 +462,7 @@ WRITE32_HANDLER( sh2_internal_w ) READ32_HANDLER( sh2_internal_r ) { - SH2 *sh2 = GET_SH2(space->cpu); + sh2_state *sh2 = GET_SH2(space->cpu); #ifdef USE_SH2DRC offset &= 0x7f; @@ -502,13 +502,13 @@ READ32_HANDLER( sh2_internal_r ) void sh2_set_ftcsr_read_callback(running_device *device, void (*callback)(UINT32)) { - SH2 *sh2 = GET_SH2(device); + sh2_state *sh2 = GET_SH2(device); sh2->ftcsr_read_callback = callback; } void sh2_set_frt_input(running_device *device, int state) { - SH2 *sh2 = GET_SH2(device); + sh2_state *sh2 = GET_SH2(device); if(state == PULSE_LINE) { @@ -540,7 +540,7 @@ void sh2_set_frt_input(running_device *device, int state) sh2_recalc_irq(sh2); } -void sh2_set_irq_line(SH2 *sh2, int irqline, int state) +void sh2_set_irq_line(sh2_state *sh2, int irqline, int state) { if (irqline == INPUT_LINE_NMI) { @@ -590,7 +590,7 @@ void sh2_set_irq_line(SH2 *sh2, int irqline, int state) } } -void sh2_recalc_irq(SH2 *sh2) +void sh2_recalc_irq(sh2_state *sh2) { int irq = 0, vector = -1; int level; @@ -634,7 +634,7 @@ void sh2_recalc_irq(SH2 *sh2) sh2->test_irq = 1; } -void sh2_exception(SH2 *sh2, const char *message, int irqline) +void sh2_exception(sh2_state *sh2, const char *message, int irqline) { int vector; @@ -699,7 +699,7 @@ void sh2_exception(SH2 *sh2, const char *message, int irqline) #endif } -void sh2_common_init(SH2 *sh2, legacy_cpu_device *device, device_irq_callback irqcallback) +void sh2_common_init(sh2_state *sh2, legacy_cpu_device *device, device_irq_callback irqcallback) { const sh2_cpu_core *conf = (const sh2_cpu_core *)device->baseconfig().static_config(); diff --git a/src/emu/cpu/sh2/sh2comn.h b/src/emu/cpu/sh2/sh2comn.h index ad3b9ad2591..73558cb96de 100644 --- a/src/emu/cpu/sh2/sh2comn.h +++ b/src/emu/cpu/sh2/sh2comn.h @@ -170,11 +170,11 @@ typedef struct drcuml_codehandle * nocode; /* nocode */ drcuml_codehandle * out_of_cycles; /* out of cycles exception handler */ #endif -} SH2; +} sh2_state; -void sh2_common_init(SH2 *sh2, legacy_cpu_device *device, device_irq_callback irqcallback); -void sh2_recalc_irq(SH2 *sh2); -void sh2_set_irq_line(SH2 *sh2, int irqline, int state); -void sh2_exception(SH2 *sh2, const char *message, int irqline); +void sh2_common_init(sh2_state *sh2, legacy_cpu_device *device, device_irq_callback irqcallback); +void sh2_recalc_irq(sh2_state *sh2); +void sh2_set_irq_line(sh2_state *sh2, int irqline, int state); +void sh2_exception(sh2_state *sh2, const char *message, int irqline); #endif /* __SH2COMN_H__ */ diff --git a/src/emu/cpu/sh2/sh2drc.c b/src/emu/cpu/sh2/sh2drc.c index 9e3b76fbaf6..d7626db72cb 100644 --- a/src/emu/cpu/sh2/sh2drc.c +++ b/src/emu/cpu/sh2/sh2drc.c @@ -99,26 +99,26 @@ struct _compiler_state FUNCTION PROTOTYPES ***************************************************************************/ -static void static_generate_entry_point(SH2 *sh2); -static void static_generate_nocode_handler(SH2 *sh2); -static void static_generate_out_of_cycles(SH2 *sh2); -static void static_generate_memory_accessor(SH2 *sh2, int size, int iswrite, const char *name, drcuml_codehandle **handleptr); - -static void generate_update_cycles(SH2 *sh2, drcuml_block *block, compiler_state *compiler, drcuml_ptype ptype, UINT64 pvalue, int allow_exception); -static void generate_checksum_block(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *seqhead, const opcode_desc *seqlast); -static void generate_sequence_instruction(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc); -static void generate_delay_slot(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc); - -static int generate_opcode(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc); -static int generate_group_0(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); -static int generate_group_2(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); -static int generate_group_3(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode); -static int generate_group_4(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); -static int generate_group_6(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); -static int generate_group_8(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); -static int generate_group_12(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); - -static void code_compile_block(SH2 *sh2, UINT8 mode, offs_t pc); +static void static_generate_entry_point(sh2_state *sh2); +static void static_generate_nocode_handler(sh2_state *sh2); +static void static_generate_out_of_cycles(sh2_state *sh2); +static void static_generate_memory_accessor(sh2_state *sh2, int size, int iswrite, const char *name, drcuml_codehandle **handleptr); + +static void generate_update_cycles(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, drcuml_ptype ptype, UINT64 pvalue, int allow_exception); +static void generate_checksum_block(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *seqhead, const opcode_desc *seqlast); +static void generate_sequence_instruction(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc); +static void generate_delay_slot(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc); + +static int generate_opcode(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc); +static int generate_group_0(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); +static int generate_group_2(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); +static int generate_group_3(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode); +static int generate_group_4(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); +static int generate_group_6(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); +static int generate_group_8(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); +static int generate_group_12(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot); + +static void code_compile_block(sh2_state *sh2, UINT8 mode, offs_t pc); static void log_opcode_desc(drcuml_state *drcuml, const opcode_desc *desclist, int indent); static void log_register_list(drcuml_state *drcuml, const char *string, const UINT32 *reglist, const UINT32 *regnostarlist); @@ -137,16 +137,15 @@ static void cfunc_DIV1(void *param); INLINE FUNCTIONS ***************************************************************************/ -INLINE SH2 *get_safe_token(running_device *device) +INLINE sh2_state *get_safe_token(running_device *device) { assert(device != NULL); - assert(device->type() == CPU); - assert(cpu_get_type(device) == CPU_SH1 || - cpu_get_type(device) == CPU_SH2); - return *(SH2 **)downcast<legacy_cpu_device *>(device)->token(); + assert(device->type() == SH1 || + device->type() == SH2); + return *(sh2_state **)downcast<legacy_cpu_device *>(device)->token(); } -INLINE UINT16 RW(SH2 *sh2, offs_t A) +INLINE UINT16 RW(sh2_state *sh2, offs_t A) { if (A >= 0xe0000000) return sh2_internal_r(sh2->internal, (A & 0x1fc)>>2, 0xffff << (((~A) & 2)*8)) >> (((~A) & 2)*8); @@ -157,7 +156,7 @@ INLINE UINT16 RW(SH2 *sh2, offs_t A) return memory_read_word_32be(sh2->program, A & AM); } -INLINE UINT32 RL(SH2 *sh2, offs_t A) +INLINE UINT32 RL(sh2_state *sh2, offs_t A) { if (A >= 0xe0000000) return sh2_internal_r(sh2->internal, (A & 0x1fc)>>2, 0xffffffff); @@ -194,7 +193,7 @@ INLINE void alloc_handle(drcuml_state *drcuml, drcuml_codehandle **handleptr, co registers -------------------------------------------------*/ -INLINE void load_fast_iregs(SH2 *sh2, drcuml_block *block) +INLINE void load_fast_iregs(sh2_state *sh2, drcuml_block *block) { int regnum; @@ -213,7 +212,7 @@ INLINE void load_fast_iregs(SH2 *sh2, drcuml_block *block) registers -------------------------------------------------*/ -INLINE void save_fast_iregs(SH2 *sh2, drcuml_block *block) +INLINE void save_fast_iregs(sh2_state *sh2, drcuml_block *block) { int regnum; @@ -233,7 +232,7 @@ INLINE void save_fast_iregs(SH2 *sh2, drcuml_block *block) static void cfunc_printf_probe(void *param) { - SH2 *sh2 = (SH2 *)param; + sh2_state *sh2 = (sh2_state *)param; UINT32 pc = sh2->pc; printf(" PC=%08X r0=%08X r1=%08X r2=%08X\n", @@ -273,7 +272,7 @@ static void cfunc_printf_probe(void *param) static void cfunc_unimplemented(void *param) { - SH2 *sh2 = (SH2 *)param; + sh2_state *sh2 = (sh2_state *)param; UINT16 opcode = sh2->arg0; fatalerror("PC=%08X: Unimplemented op %04X", sh2->pc, opcode); } @@ -283,7 +282,7 @@ static void cfunc_unimplemented(void *param) -------------------------------------------------*/ static void cfunc_checkirqs(void *param) { - SH2 *sh2 = (SH2 *)param; + sh2_state *sh2 = (sh2_state *)param; // if NMI is pending, evec etc are already set up if (sh2->pending_nmi) { @@ -301,7 +300,7 @@ static void cfunc_checkirqs(void *param) -------------------------------------------------*/ static void cfunc_fastirq(void *param) { - SH2 *sh2 = (SH2 *)param; + sh2_state *sh2 = (sh2_state *)param; sh2_exception(sh2, "fastirq",sh2->irqline); } @@ -310,7 +309,7 @@ static void cfunc_fastirq(void *param) -------------------------------------------------*/ static void cfunc_MAC_W(void *param) { - SH2 *sh2 = (SH2 *)param; + sh2_state *sh2 = (sh2_state *)param; INT32 tempm, tempn, dest, src, ans; UINT32 templ; UINT16 opcode; @@ -393,7 +392,7 @@ static void cfunc_MAC_W(void *param) -------------------------------------------------*/ static void cfunc_MAC_L(void *param) { - SH2 *sh2 = (SH2 *)param; + sh2_state *sh2 = (sh2_state *)param; UINT32 RnL, RnH, RmL, RmH, Res0, Res1, Res2; UINT32 temp0, temp1, temp2, temp3; INT32 tempm, tempn, fnLmL; @@ -481,7 +480,7 @@ static void cfunc_MAC_L(void *param) -------------------------------------------------*/ static void cfunc_DIV1(void *param) { - SH2 *sh2 = (SH2 *)param; + sh2_state *sh2 = (sh2_state *)param; UINT32 tmp0; UINT32 old_q; UINT16 opcode; @@ -586,7 +585,7 @@ static void cfunc_DIV1(void *param) -------------------------------------------------*/ static void cfunc_ADDV(void *param) { - SH2 *sh2 = (SH2 *)param; + sh2_state *sh2 = (sh2_state *)param; INT32 dest, src, ans; UINT16 opcode; int n, m; @@ -629,7 +628,7 @@ static void cfunc_ADDV(void *param) -------------------------------------------------*/ static void cfunc_SUBV(void *param) { - SH2 *sh2 = (SH2 *)param; + sh2_state *sh2 = (sh2_state *)param; INT32 dest, src, ans; UINT16 opcode; int n, m; @@ -681,20 +680,20 @@ static CPU_INIT( sh2 ) COMPILE_MAX_SEQUENCE, /* maximum instructions to include in a sequence */ sh2_describe /* callback to describe a single instruction */ }; - SH2 *sh2 = get_safe_token(device); + sh2_state *sh2 = get_safe_token(device); drccache *cache; drcbe_info beinfo; UINT32 flags = 0; int regnum; /* allocate enough space for the cache and the core */ - cache = drccache_alloc(CACHE_SIZE + sizeof(SH2)); + cache = drccache_alloc(CACHE_SIZE + sizeof(sh2_state)); if (cache == NULL) - fatalerror("Unable to allocate cache of size %d", (UINT32)(CACHE_SIZE + sizeof(SH2))); + fatalerror("Unable to allocate cache of size %d", (UINT32)(CACHE_SIZE + sizeof(sh2_state))); /* allocate the core memory */ - *(SH2 **)device->token() = sh2 = (SH2 *)drccache_memory_alloc_near(cache, sizeof(SH2)); - memset(sh2, 0, sizeof(SH2)); + *(sh2_state **)device->token() = sh2 = (sh2_state *)drccache_memory_alloc_near(cache, sizeof(sh2_state)); + memset(sh2, 0, sizeof(sh2_state)); /* initialize the common core parts */ sh2_common_init(sh2, device, irqcallback); @@ -776,7 +775,7 @@ static CPU_INIT( sh2 ) static CPU_EXIT( sh2 ) { - SH2 *sh2 = get_safe_token(device); + sh2_state *sh2 = get_safe_token(device); /* clean up the DRC */ drcfe_exit(sh2->drcfe); @@ -791,7 +790,7 @@ static CPU_EXIT( sh2 ) static CPU_RESET( sh2 ) { - SH2 *sh2 = get_safe_token(device); + sh2_state *sh2 = get_safe_token(device); emu_timer *tsave, *tsaved0, *tsaved1; UINT32 *m; @@ -845,7 +844,7 @@ static CPU_RESET( sh2 ) static CPU_RESET( sh1 ) { - SH2 *sh2 = get_safe_token(device); + sh2_state *sh2 = get_safe_token(device); CPU_RESET_CALL(sh2); sh2->cpu_type = CPU_TYPE_SH1; } @@ -855,7 +854,7 @@ static CPU_RESET( sh1 ) regenerate static code -------------------------------------------------*/ -static void code_flush_cache(SH2 *sh2) +static void code_flush_cache(sh2_state *sh2) { drcuml_state *drcuml = sh2->drcuml; @@ -881,7 +880,7 @@ static void code_flush_cache(SH2 *sh2) /* Execute cycles - returns number of cycles actually run */ static CPU_EXECUTE( sh2 ) { - SH2 *sh2 = get_safe_token(device); + sh2_state *sh2 = get_safe_token(device); drcuml_state *drcuml = sh2->drcuml; int execute_result; @@ -916,7 +915,7 @@ static CPU_EXECUTE( sh2 ) given mode at the specified pc -------------------------------------------------*/ -static void code_compile_block(SH2 *sh2, UINT8 mode, offs_t pc) +static void code_compile_block(sh2_state *sh2, UINT8 mode, offs_t pc) { drcuml_state *drcuml = sh2->drcuml; compiler_state compiler = { 0 }; @@ -1025,7 +1024,7 @@ static void code_compile_block(SH2 *sh2, UINT8 mode, offs_t pc) static entry point -------------------------------------------------*/ -static void static_generate_entry_point(SH2 *sh2) +static void static_generate_entry_point(sh2_state *sh2) { drcuml_state *drcuml = sh2->drcuml; drcuml_codelabel skip = 1; @@ -1110,7 +1109,7 @@ static void static_generate_entry_point(SH2 *sh2) exception handler for "out of code" -------------------------------------------------*/ -static void static_generate_nocode_handler(SH2 *sh2) +static void static_generate_nocode_handler(sh2_state *sh2) { drcuml_state *drcuml = sh2->drcuml; drcuml_block *block; @@ -1140,7 +1139,7 @@ static void static_generate_nocode_handler(SH2 *sh2) out of cycles exception handler -------------------------------------------------*/ -static void static_generate_out_of_cycles(SH2 *sh2) +static void static_generate_out_of_cycles(sh2_state *sh2) { drcuml_state *drcuml = sh2->drcuml; drcuml_block *block; @@ -1168,7 +1167,7 @@ static void static_generate_out_of_cycles(SH2 *sh2) static_generate_memory_accessor ------------------------------------------------------------------*/ -static void static_generate_memory_accessor(SH2 *sh2, int size, int iswrite, const char *name, drcuml_codehandle **handleptr) +static void static_generate_memory_accessor(sh2_state *sh2, int size, int iswrite, const char *name, drcuml_codehandle **handleptr) { /* on entry, address is in I0; data for writes is in I1 */ /* on exit, read result is in I0 */ @@ -1427,7 +1426,7 @@ static void log_add_disasm_comment(drcuml_block *block, UINT32 pc, UINT32 op) subtract cycles from the icount and generate an exception if out -------------------------------------------------*/ -static void generate_update_cycles(SH2 *sh2, drcuml_block *block, compiler_state *compiler, drcuml_ptype ptype, UINT64 pvalue, int allow_exception) +static void generate_update_cycles(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, drcuml_ptype ptype, UINT64 pvalue, int allow_exception) { /* check full interrupts if pending */ if (compiler->checkints) @@ -1505,7 +1504,7 @@ static void generate_update_cycles(SH2 *sh2, drcuml_block *block, compiler_state validate a sequence of opcodes -------------------------------------------------*/ -static void generate_checksum_block(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *seqhead, const opcode_desc *seqlast) +static void generate_checksum_block(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *seqhead, const opcode_desc *seqlast) { const opcode_desc *curdesc; if (LOG_UML) @@ -1560,7 +1559,7 @@ static void generate_checksum_block(SH2 *sh2, drcuml_block *block, compiler_stat for a single instruction in a sequence -------------------------------------------------*/ -static void generate_sequence_instruction(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc) +static void generate_sequence_instruction(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc) { offs_t expc; @@ -1644,7 +1643,7 @@ static void generate_sequence_instruction(SH2 *sh2, drcuml_block *block, compile generate_delay_slot ------------------------------------------------------------------*/ -static void generate_delay_slot(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc) +static void generate_delay_slot(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc) { compiler_state compiler_temp = *compiler; @@ -1661,7 +1660,7 @@ static void generate_delay_slot(SH2 *sh2, drcuml_block *block, compiler_state *c opcode -------------------------------------------------*/ -static int generate_opcode(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc) +static int generate_opcode(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc) { UINT32 scratch, scratch2; INT32 disp; @@ -1795,7 +1794,7 @@ static int generate_opcode(SH2 *sh2, drcuml_block *block, compiler_state *compil return FALSE; } -static int generate_group_0(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) +static int generate_group_0(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) { switch (opcode & 0x3F) { @@ -2058,7 +2057,7 @@ static int generate_group_0(SH2 *sh2, drcuml_block *block, compiler_state *compi return FALSE; } -static int generate_group_2(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) +static int generate_group_2(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) { switch (opcode & 15) { @@ -2227,7 +2226,7 @@ static int generate_group_2(SH2 *sh2, drcuml_block *block, compiler_state *compi return FALSE; } -static int generate_group_3(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode) +static int generate_group_3(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode) { switch (opcode & 15) { @@ -2339,7 +2338,7 @@ static int generate_group_3(SH2 *sh2, drcuml_block *block, compiler_state *compi return FALSE; } -static int generate_group_4(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) +static int generate_group_4(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) { switch (opcode & 0x3F) { @@ -2704,7 +2703,7 @@ static int generate_group_4(SH2 *sh2, drcuml_block *block, compiler_state *compi return FALSE; } -static int generate_group_6(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) +static int generate_group_6(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) { switch (opcode & 15) { @@ -2834,7 +2833,7 @@ static int generate_group_6(SH2 *sh2, drcuml_block *block, compiler_state *compi return FALSE; } -static int generate_group_8(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) +static int generate_group_8(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) { INT32 disp; UINT32 udisp; @@ -2978,7 +2977,7 @@ static int generate_group_8(SH2 *sh2, drcuml_block *block, compiler_state *compi return FALSE; } -static int generate_group_12(SH2 *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) +static int generate_group_12(sh2_state *sh2, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot) { UINT32 scratch; @@ -3153,7 +3152,7 @@ static int generate_group_12(SH2 *sh2, drcuml_block *block, compiler_state *comp void sh2drc_set_options(running_device *device, UINT32 options) { - SH2 *sh2 = get_safe_token(device); + sh2_state *sh2 = get_safe_token(device); sh2->drcoptions = options; } @@ -3165,7 +3164,7 @@ void sh2drc_set_options(running_device *device, UINT32 options) void sh2drc_add_pcflush(running_device *device, offs_t address) { - SH2 *sh2 = get_safe_token(device); + sh2_state *sh2 = get_safe_token(device); if (sh2->pcfsel < ARRAY_LENGTH(sh2->pcflushes)) sh2->pcflushes[sh2->pcfsel++] = address; @@ -3199,7 +3198,7 @@ ADDRESS_MAP_END static CPU_SET_INFO( sh2 ) { - SH2 *sh2 = get_safe_token(device); + sh2_state *sh2 = get_safe_token(device); switch (state) { /* --- the following bits of info are set as 64-bit signed integers --- */ @@ -3258,11 +3257,11 @@ static CPU_SET_INFO( sh2 ) CPU_GET_INFO( sh2 ) { - SH2 *sh2 = (device != NULL && device->token() != NULL) ? get_safe_token(device) : NULL; + sh2_state *sh2 = (device != NULL && device->token() != NULL) ? get_safe_token(device) : NULL; switch (state) { /* --- the following bits of info are returned as 64-bit signed integers --- */ - case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(SH2 *); break; + case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(sh2_state *); break; case CPUINFO_INT_INPUT_LINES: info->i = 16; break; case CPUINFO_INT_DEFAULT_IRQ_VECTOR: info->i = 0; break; case DEVINFO_INT_ENDIANNESS: info->i = ENDIANNESS_BIG; break; @@ -3408,4 +3407,7 @@ CPU_GET_INFO( sh1 ) } } +DEFINE_LEGACY_CPU_DEVICE(SH1, sh1); +DEFINE_LEGACY_CPU_DEVICE(SH2, sh2); + #endif // USE_SH2DRC diff --git a/src/emu/cpu/sh2/sh2fe.c b/src/emu/cpu/sh2/sh2fe.c index 89ea586004d..4afe1778ef9 100644 --- a/src/emu/cpu/sh2/sh2fe.c +++ b/src/emu/cpu/sh2/sh2fe.c @@ -18,13 +18,13 @@ FUNCTION PROTOTYPES ***************************************************************************/ -static int describe_group_0(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); -static int describe_group_2(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); -static int describe_group_3(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); -static int describe_group_4(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); -static int describe_group_6(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); -static int describe_group_8(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); -static int describe_group_12(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); +static int describe_group_0(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); +static int describe_group_2(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); +static int describe_group_3(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); +static int describe_group_4(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); +static int describe_group_6(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); +static int describe_group_8(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); +static int describe_group_12(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode); @@ -39,7 +39,7 @@ static int describe_group_12(SH2 *context, opcode_desc *desc, const opcode_desc int sh2_describe(void *param, opcode_desc *desc, const opcode_desc *prev) { - SH2 *context = (SH2 *)param; + sh2_state *context = (sh2_state *)param; UINT16 opcode; /* fetch the opcode */ @@ -123,7 +123,7 @@ int sh2_describe(void *param, opcode_desc *desc, const opcode_desc *prev) return FALSE; } -static int describe_group_0(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) +static int describe_group_0(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) { switch (opcode & 0x3F) { @@ -292,7 +292,7 @@ static int describe_group_0(SH2 *context, opcode_desc *desc, const opcode_desc * return FALSE; } -static int describe_group_2(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) +static int describe_group_2(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) { switch (opcode & 15) { @@ -340,7 +340,7 @@ static int describe_group_2(SH2 *context, opcode_desc *desc, const opcode_desc * return FALSE; } -static int describe_group_3(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) +static int describe_group_3(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) { switch (opcode & 15) { @@ -389,7 +389,7 @@ static int describe_group_3(SH2 *context, opcode_desc *desc, const opcode_desc * return FALSE; } -static int describe_group_4(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) +static int describe_group_4(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) { switch (opcode & 0x3F) { @@ -619,7 +619,7 @@ static int describe_group_4(SH2 *context, opcode_desc *desc, const opcode_desc * return FALSE; } -static int describe_group_6(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) +static int describe_group_6(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) { switch (opcode & 15) { @@ -660,7 +660,7 @@ static int describe_group_6(SH2 *context, opcode_desc *desc, const opcode_desc * return FALSE; } -static int describe_group_8(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) +static int describe_group_8(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) { INT32 disp; @@ -715,7 +715,7 @@ static int describe_group_8(SH2 *context, opcode_desc *desc, const opcode_desc * return FALSE; } -static int describe_group_12(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) +static int describe_group_12(sh2_state *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode) { switch (opcode & (15<<8)) { |