src/emu/cpu/powerpc/ppccom.c
| r9474 | r9475 | |
| 132 | 132 | |
| 133 | 133 | INLINE UINT64 get_timebase(powerpc_state *ppc) |
| 134 | 134 | { |
| 135 | if (!ppc->tb_divisor) |
| 136 | { |
| 137 | return (ppc->device->total_cycles() - ppc->tb_zero_cycles); |
| 138 | } |
| 139 | |
| 135 | 140 | return (ppc->device->total_cycles() - ppc->tb_zero_cycles) / ppc->tb_divisor; |
| 136 | 141 | } |
| 137 | 142 | |
| r9474 | r9475 | |
| 155 | 160 | { |
| 156 | 161 | INT64 cycles_until_zero = ppc->dec_zero_cycles - ppc->device->total_cycles(); |
| 157 | 162 | cycles_until_zero = MAX(cycles_until_zero, 0); |
| 163 | |
| 164 | if (!ppc->tb_divisor) |
| 165 | { |
| 166 | return 0; |
| 167 | } |
| 168 | |
| 158 | 169 | return cycles_until_zero / ppc->tb_divisor; |
| 159 | 170 | } |
| 160 | 171 | |
| r9474 | r9475 | |
| 168 | 179 | UINT64 cycles_until_done = ((UINT64)newdec + 1) * ppc->tb_divisor; |
| 169 | 180 | UINT32 curdec = get_decrementer(ppc); |
| 170 | 181 | |
| 182 | if (!ppc->tb_divisor) |
| 183 | { |
| 184 | return; |
| 185 | } |
| 186 | |
| 171 | 187 | if (PRINTF_DECREMENTER) |
| 172 | 188 | { |
| 173 | 189 | UINT64 total = ppc->device->total_cycles(); |
| r9474 | r9475 | |
| 311 | 327 | ppc->vtlb = vtlb_alloc(device, ADDRESS_SPACE_PROGRAM, (cap & PPCCAP_603_MMU) ? PPC603_FIXED_TLB_ENTRIES : 0, POWERPC_TLB_ENTRIES); |
| 312 | 328 | |
| 313 | 329 | /* allocate a timer for the compare interrupt */ |
| 314 | | if (cap & PPCCAP_OEA) |
| 330 | if ((cap & PPCCAP_OEA) && (ppc->tb_divisor)) |
| 315 | 331 | ppc->decrementer_int_timer = timer_alloc(device->machine, decrementer_int_callback, ppc); |
| 316 | 332 | |
| 317 | 333 | /* and for the 4XX interrupts if needed */ |
| r9474 | r9475 | |
| 385 | 401 | |
| 386 | 402 | /* reset the decrementer */ |
| 387 | 403 | 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 | } |
| 389 | 408 | } |
| 390 | 409 | |
| 391 | 410 | /* initialize the 4XX state */ |