diff --git a/SheepShaver/src/Unix/main_unix.cpp b/SheepShaver/src/Unix/main_unix.cpp index d58d5333..ca09cd8d 100644 --- a/SheepShaver/src/Unix/main_unix.cpp +++ b/SheepShaver/src/Unix/main_unix.cpp @@ -1536,7 +1536,11 @@ void ClearInterruptFlag(uint32 flag) void DisableInterrupt(void) { +#if EMULATED_PPC + WriteMacInt32(XLM_IRQ_NEST, int32(ReadMacInt32(XLM_IRQ_NEST)) + 1); +#else atomic_add((int *)XLM_IRQ_NEST, 1); +#endif } @@ -1546,7 +1550,11 @@ void DisableInterrupt(void) void EnableInterrupt(void) { +#if EMULATED_PPC + WriteMacInt32(XLM_IRQ_NEST, int32(ReadMacInt32(XLM_IRQ_NEST)) - 1); +#else atomic_add((int *)XLM_IRQ_NEST, -1); +#endif } diff --git a/SheepShaver/src/include/thunks.h b/SheepShaver/src/include/thunks.h index 960991e6..445e1cae 100644 --- a/SheepShaver/src/include/thunks.h +++ b/SheepShaver/src/include/thunks.h @@ -51,8 +51,6 @@ enum { NATIVE_GET_IND_RESOURCE, NATIVE_GET_1_IND_RESOURCE, NATIVE_R_GET_RESOURCE, - NATIVE_DISABLE_INTERRUPT, - NATIVE_ENABLE_INTERRUPT, NATIVE_MAKE_EXECUTABLE, NATIVE_CHECK_LOAD_INVOC, NATIVE_SYNC_HOOK, diff --git a/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp b/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp index f218304c..e7f1442e 100644 --- a/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp +++ b/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp @@ -446,14 +446,6 @@ int sheepshaver_cpu::compile1(codegen_context_t & cg_context) status = COMPILE_CODE_OK; break; #endif - case NATIVE_DISABLE_INTERRUPT: - dg.gen_invoke(DisableInterrupt); - status = COMPILE_CODE_OK; - break; - case NATIVE_ENABLE_INTERRUPT: - dg.gen_invoke(EnableInterrupt); - status = COMPILE_CODE_OK; - break; case NATIVE_BITBLT: dg.gen_load_T0_GPR(3); dg.gen_invoke_T0((void (*)(uint32))NQD_bitblt); @@ -1068,7 +1060,7 @@ void TriggerInterrupt(void) void sheepshaver_cpu::handle_interrupt(void) { // Do nothing if interrupts are disabled - if (*(int32 *)XLM_IRQ_NEST > 0) + if (int32(ReadMacInt32(XLM_IRQ_NEST)) > 0) return; // Current interrupt nest level @@ -1266,12 +1258,6 @@ void sheepshaver_cpu::execute_native_op(uint32 selector) get_resource_callbacks[selector - NATIVE_GET_RESOURCE](); break; } - case NATIVE_DISABLE_INTERRUPT: - DisableInterrupt(); - break; - case NATIVE_ENABLE_INTERRUPT: - EnableInterrupt(); - break; case NATIVE_MAKE_EXECUTABLE: MakeExecutable(0, (void *)gpr(4), gpr(5)); break; diff --git a/SheepShaver/src/rom_patches.cpp b/SheepShaver/src/rom_patches.cpp index f59c2ce5..eb13d459 100644 --- a/SheepShaver/src/rom_patches.cpp +++ b/SheepShaver/src/rom_patches.cpp @@ -1122,13 +1122,9 @@ static bool patch_68k_emul(void) // Extra routine for 68k emulator start lp = (uint32 *)(ROM_BASE + 0x36f900); *lp++ = htonl(0x7c2903a6); // mtctr r1 -#if EMULATED_PPC - *lp++ = htonl(NativeOpcode(NATIVE_DISABLE_INTERRUPT)); -#else *lp++ = htonl(0x80200000 + XLM_IRQ_NEST); // lwz r1,XLM_IRQ_NEST *lp++ = htonl(0x38210001); // addi r1,r1,1 *lp++ = htonl(0x90200000 + XLM_IRQ_NEST); // stw r1,XLM_IRQ_NEST -#endif *lp++ = htonl(0x80200000 + XLM_KERNEL_DATA);// lwz r1,XLM_KERNEL_DATA *lp++ = htonl(0x90c10018); // stw r6,0x18(r1) *lp++ = htonl(0x7cc902a6); // mfctr r6 @@ -1156,13 +1152,9 @@ static bool patch_68k_emul(void) // Extra routine for Mixed Mode lp = (uint32 *)(ROM_BASE + 0x36fa00); *lp++ = htonl(0x7c2903a6); // mtctr r1 -#if EMULATED_PPC - *lp++ = htonl(NativeOpcode(NATIVE_DISABLE_INTERRUPT)); -#else *lp++ = htonl(0x80200000 + XLM_IRQ_NEST); // lwz r1,XLM_IRQ_NEST *lp++ = htonl(0x38210001); // addi r1,r1,1 *lp++ = htonl(0x90200000 + XLM_IRQ_NEST); // stw r1,XLM_IRQ_NEST -#endif *lp++ = htonl(0x80200000 + XLM_KERNEL_DATA);// lwz r1,XLM_KERNEL_DATA *lp++ = htonl(0x90c10018); // stw r6,0x18(r1) *lp++ = htonl(0x7cc902a6); // mfctr r6 @@ -1190,13 +1182,9 @@ static bool patch_68k_emul(void) // Extra routine for Reset/FC1E opcode lp = (uint32 *)(ROM_BASE + 0x36fb00); *lp++ = htonl(0x7c2903a6); // mtctr r1 -#if EMULATED_PPC - *lp++ = htonl(NativeOpcode(NATIVE_DISABLE_INTERRUPT)); -#else *lp++ = htonl(0x80200000 + XLM_IRQ_NEST); // lwz r1,XLM_IRQ_NEST *lp++ = htonl(0x38210001); // addi r1,r1,1 *lp++ = htonl(0x90200000 + XLM_IRQ_NEST); // stw r1,XLM_IRQ_NEST -#endif *lp++ = htonl(0x80200000 + XLM_KERNEL_DATA);// lwz r1,XLM_KERNEL_DATA *lp++ = htonl(0x90c10018); // stw r6,0x18(r1) *lp++ = htonl(0x7cc902a6); // mfctr r6 @@ -1224,13 +1212,9 @@ static bool patch_68k_emul(void) // Extra routine for FE0A opcode (QuickDraw 3D needs this) lp = (uint32 *)(ROM_BASE + 0x36fc00); *lp++ = htonl(0x7c2903a6); // mtctr r1 -#if EMULATED_PPC - *lp++ = htonl(NativeOpcode(NATIVE_DISABLE_INTERRUPT)); -#else *lp++ = htonl(0x80200000 + XLM_IRQ_NEST); // lwz r1,XLM_IRQ_NEST *lp++ = htonl(0x38210001); // addi r1,r1,1 *lp++ = htonl(0x90200000 + XLM_IRQ_NEST); // stw r1,XLM_IRQ_NEST -#endif *lp++ = htonl(0x80200000 + XLM_KERNEL_DATA);// lwz r1,XLM_KERNEL_DATA *lp++ = htonl(0x90c10018); // stw r6,0x18(r1) *lp++ = htonl(0x7cc902a6); // mfctr r6 @@ -1397,15 +1381,10 @@ static bool patch_nanokernel(void) uint32 npc = (uint32)(lp + 1) - ROM_BASE; lp = (uint32 *)(ROM_BASE + 0x318000); -#if EMULATED_PPC - *lp++ = htonl(NativeOpcode(NATIVE_ENABLE_INTERRUPT)); - *lp = htonl(0x48000000 + ((npc - 0x318004) & 0x03fffffc)); // b ROM_BASE+0x312c2c -#else *lp++ = htonl(0x81400000 + XLM_IRQ_NEST); // lwz r10,XLM_IRQ_NEST *lp++ = htonl(0x394affff); // subi r10,r10,1 *lp++ = htonl(0x91400000 + XLM_IRQ_NEST); // stw r10,XLM_IRQ_NEST *lp = htonl(0x48000000 + ((npc - 0x31800c) & 0x03fffffc)); // b ROM_BASE+0x312c2c -#endif /* // Disable FE0A/FE06 opcodes diff --git a/SheepShaver/src/thunks.cpp b/SheepShaver/src/thunks.cpp index af05e504..b63a2a7f 100644 --- a/SheepShaver/src/thunks.cpp +++ b/SheepShaver/src/thunks.cpp @@ -55,8 +55,6 @@ uint32 NativeOpcode(int selector) { uint32 opcode; switch (selector) { - case NATIVE_DISABLE_INTERRUPT: - case NATIVE_ENABLE_INTERRUPT: case NATIVE_CHECK_LOAD_INVOC: opcode = POWERPC_NATIVE_OP(0, selector); break;