--- SheepShaver/src/emul_op.cpp 2002/02/04 16:58:13 1.1 +++ SheepShaver/src/emul_op.cpp 2003/12/04 17:26:35 1.5 @@ -45,6 +45,7 @@ #include "name_registry.h" #include "user_strings.h" #include "emul_op.h" +#include "thunks.h" #define DEBUG 0 #include "debug.h" @@ -67,7 +68,6 @@ static uint32 *MakeExecutableTvec; void EmulOp(M68kRegisters *r, uint32 pc, int selector) { - D(bug("EmulOp %04x at %08x\n", selector, pc)); switch (selector) { case OP_BREAK: // Breakpoint @@ -258,23 +258,19 @@ void EmulOp(M68kRegisters *r, uint32 pc, // Install drivers InstallDrivers(); -#if !EMULATED_PPC // Patch MakeExecutable() MakeExecutableTvec = (uint32 *)FindLibSymbol("\023PrivateInterfaceLib", "\016MakeExecutable"); D(bug("MakeExecutable TVECT at %p\n", MakeExecutableTvec)); -#ifdef __BEOS__ - MakeExecutableTvec[0] = ((uint32 *)MakeExecutable)[0]; -#else - MakeExecutableTvec[0] = (uint32)MakeExecutable; -#endif + MakeExecutableTvec[0] = htonl(NativeFunction(NATIVE_MAKE_EXECUTABLE)); +#if !EMULATED_PPC MakeExecutableTvec[1] = (uint32)TOC; #endif // Patch DebugStr() - static const uint16 proc[] = { - M68K_EMUL_OP_DEBUG_STR, - 0x4e74, // rtd #4 - 0x0004 + static const uint8 proc[] = { + M68K_EMUL_OP_DEBUG_STR >> 8, M68K_EMUL_OP_DEBUG_STR & 0xff, + 0x4e, 0x74, // rtd #4 + 0x00, 0x04 }; WriteMacInt32(0x1dfc, (uint32)proc); break; @@ -311,7 +307,11 @@ void EmulOp(M68kRegisters *r, uint32 pc, #if !PRECISE_TIMING TimerInterrupt(); #endif +#if EMULATED_PPC + ExecuteNative(NATIVE_VIDEO_VBL); +#else ExecutePPC(VideoVBL); +#endif static int tick_counter = 0; if (++tick_counter >= 60) { @@ -329,7 +329,11 @@ void EmulOp(M68kRegisters *r, uint32 pc, } if (InterruptFlags & INTFLAG_ETHER) { ClearInterruptFlag(INTFLAG_ETHER); +#if EMULATED_PPC + ExecuteNative(NATIVE_ETHER_IRQ); +#else ExecutePPC(EtherIRQ); +#endif } if (InterruptFlags & INTFLAG_TIMER) { ClearInterruptFlag(INTFLAG_TIMER);