86 |
|
// Enable multicore (main/interrupts) cpu emulation? |
87 |
|
#define MULTICORE_CPU (ASYNC_IRQ ? 1 : 0) |
88 |
|
|
89 |
+ |
// Enable interrupt routine safety checks? |
90 |
+ |
#define SAFE_INTERRUPT_PPC 1 |
91 |
+ |
|
92 |
|
// Enable Execute68k() safety checks? |
93 |
|
#define SAFE_EXEC_68K 1 |
94 |
|
|
415 |
|
const clock_t interrupt_start = clock(); |
416 |
|
#endif |
417 |
|
|
418 |
+ |
#if SAFE_INTERRUPT_PPC |
419 |
+ |
static int depth = 0; |
420 |
+ |
if (depth != 0) |
421 |
+ |
printf("FATAL: sheepshaver_cpu::interrupt() called more than once: %d\n", depth); |
422 |
+ |
depth++; |
423 |
+ |
#endif |
424 |
+ |
#if SAFE_INTERRUPT_PPC >= 2 |
425 |
+ |
uint32 saved_regs[32]; |
426 |
+ |
memcpy(&saved_regs[0], &gpr(0), sizeof(saved_regs)); |
427 |
+ |
#endif |
428 |
+ |
|
429 |
|
#if !MULTICORE_CPU |
430 |
|
// Save program counters and branch registers |
431 |
|
uint32 saved_pc = pc(); |
483 |
|
#if EMUL_TIME_STATS |
484 |
|
interrupt_time += (clock() - interrupt_start); |
485 |
|
#endif |
486 |
+ |
|
487 |
+ |
#if SAFE_INTERRUPT_PPC >= 2 |
488 |
+ |
if (memcmp(&saved_regs[0], &gpr(0), sizeof(saved_regs)) != 0) |
489 |
+ |
printf("FATAL: dirty PowerPC registers\n"); |
490 |
+ |
#endif |
491 |
+ |
#if SAFE_INTERRUPT_PPC |
492 |
+ |
depth--; |
493 |
+ |
#endif |
494 |
|
} |
495 |
|
|
496 |
|
// Execute 68k routine |