diff options
| author | 2010-10-30 01:15:51 +0000 | |
|---|---|---|
| committer | 2010-10-30 01:15:51 +0000 | |
| commit | 66ccc4c8a4b5ab1496c777068754fe7684849a87 (patch) | |
| tree | 7b7b31d7bba4fc2d5a752c7b35d5fb8c3d979c90 /src | |
| parent | 508c3c3677c684a7db10aaee40c3fae2148c0b43 (diff) | |
PPC: don't crash 601
(Aaron, please feel free to hate this and redo it correctly. It does seem to work for me though).
Diffstat (limited to 'src')
| -rw-r--r-- | src/emu/cpu/powerpc/ppccom.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/emu/cpu/powerpc/ppccom.c b/src/emu/cpu/powerpc/ppccom.c index e4428c93f2b..67390187775 100644 --- a/src/emu/cpu/powerpc/ppccom.c +++ b/src/emu/cpu/powerpc/ppccom.c @@ -132,6 +132,11 @@ INLINE void set_xer(powerpc_state *ppc, UINT32 value) INLINE UINT64 get_timebase(powerpc_state *ppc) { + if (!ppc->tb_divisor) + { + return (ppc->device->total_cycles() - ppc->tb_zero_cycles); + } + return (ppc->device->total_cycles() - ppc->tb_zero_cycles) / ppc->tb_divisor; } @@ -155,6 +160,12 @@ INLINE UINT32 get_decrementer(powerpc_state *ppc) { INT64 cycles_until_zero = ppc->dec_zero_cycles - ppc->device->total_cycles(); cycles_until_zero = MAX(cycles_until_zero, 0); + + if (!ppc->tb_divisor) + { + return 0; + } + return cycles_until_zero / ppc->tb_divisor; } @@ -168,6 +179,11 @@ INLINE void set_decrementer(powerpc_state *ppc, UINT32 newdec) UINT64 cycles_until_done = ((UINT64)newdec + 1) * ppc->tb_divisor; UINT32 curdec = get_decrementer(ppc); + if (!ppc->tb_divisor) + { + return; + } + if (PRINTF_DECREMENTER) { UINT64 total = ppc->device->total_cycles(); @@ -311,7 +327,7 @@ void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_di ppc->vtlb = vtlb_alloc(device, ADDRESS_SPACE_PROGRAM, (cap & PPCCAP_603_MMU) ? PPC603_FIXED_TLB_ENTRIES : 0, POWERPC_TLB_ENTRIES); /* allocate a timer for the compare interrupt */ - if (cap & PPCCAP_OEA) + if ((cap & PPCCAP_OEA) && (ppc->tb_divisor)) ppc->decrementer_int_timer = timer_alloc(device->machine, decrementer_int_callback, ppc); /* and for the 4XX interrupts if needed */ @@ -385,7 +401,10 @@ void ppccom_reset(powerpc_state *ppc) /* reset the decrementer */ ppc->dec_zero_cycles = ppc->device->total_cycles(); - decrementer_int_callback(ppc->device->machine, ppc, 0); + if (ppc->tb_divisor) + { + decrementer_int_callback(ppc->device->machine, ppc, 0); + } } /* initialize the 4XX state */ |
