Previous 15994 Revisions Next

r9475 Saturday 30th October, 2010 at 12:32:25 UTC by R. Belmont
[PowerPC] Fix crashing on 601, which has no decrementer (also submitted to MAME)
[src/emu/cpu/powerpc]ppccom.c

src/emu/cpu/powerpc/ppccom.c
r9474r9475
132132
133133INLINE UINT64 get_timebase(powerpc_state *ppc)
134134{
135   if (!ppc->tb_divisor)
136   {
137      return (ppc->device->total_cycles() - ppc->tb_zero_cycles);
138   }
139
135140   return (ppc->device->total_cycles() - ppc->tb_zero_cycles) / ppc->tb_divisor;
136141}
137142
r9474r9475
155160{
156161   INT64 cycles_until_zero = ppc->dec_zero_cycles - ppc->device->total_cycles();
157162   cycles_until_zero = MAX(cycles_until_zero, 0);
163
164   if (!ppc->tb_divisor)
165   {
166      return 0;
167   }
168
158169   return cycles_until_zero / ppc->tb_divisor;
159170}
160171
r9474r9475
168179   UINT64 cycles_until_done = ((UINT64)newdec + 1) * ppc->tb_divisor;
169180   UINT32 curdec = get_decrementer(ppc);
170181
182   if (!ppc->tb_divisor)
183   {
184      return;
185   }
186
171187   if (PRINTF_DECREMENTER)
172188   {
173189      UINT64 total = ppc->device->total_cycles();
r9474r9475
311327   ppc->vtlb = vtlb_alloc(device, ADDRESS_SPACE_PROGRAM, (cap & PPCCAP_603_MMU) ? PPC603_FIXED_TLB_ENTRIES : 0, POWERPC_TLB_ENTRIES);
312328
313329   /* allocate a timer for the compare interrupt */
314   if (cap & PPCCAP_OEA)
330   if ((cap & PPCCAP_OEA) && (ppc->tb_divisor))
315331      ppc->decrementer_int_timer = timer_alloc(device->machine, decrementer_int_callback, ppc);
316332
317333   /* and for the 4XX interrupts if needed */
r9474r9475
385401
386402      /* reset the decrementer */
387403      ppc->dec_zero_cycles = ppc->device->total_cycles();
388      decrementer_int_callback(ppc->device->machine, ppc, 0);
404      if (ppc->tb_divisor)
405      {
406         decrementer_int_callback(ppc->device->machine, ppc, 0);
407      }
389408   }
390409
391410   /* initialize the 4XX state */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team