From a533a9c45530b61004a7aa6f48ec78e491fab29c Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Mon, 31 May 2004 10:02:20 +0000 Subject: [PATCH] Enable DR emulator with OldWorld ROMs too. It turned out that translated code was also trying to access Serial memory. Note however that I noticed some rare crashes with the DR emulator. Probably caused by nested runs from EmulOps? We'd really want a native 68k emulator too for Execute68k() things. --- SheepShaver/src/Unix/main_unix.cpp | 12 ++++++++++-- SheepShaver/src/emul_op.cpp | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/SheepShaver/src/Unix/main_unix.cpp b/SheepShaver/src/Unix/main_unix.cpp index 54eb670a..9040cddb 100644 --- a/SheepShaver/src/Unix/main_unix.cpp +++ b/SheepShaver/src/Unix/main_unix.cpp @@ -1603,8 +1603,8 @@ static void sigsegv_handler(int sig, siginfo_t *sip, void *scp) num_segv++; - // Fault in Mac ROM or RAM? - bool mac_fault = (r->pc() >= ROM_BASE) && (r->pc() < (ROM_BASE + ROM_AREA_SIZE)) || (r->pc() >= RAMBase) && (r->pc() < (RAMBase + RAMSize)); + // Fault in Mac ROM or RAM or DR Cache? + bool mac_fault = (r->pc() >= ROM_BASE) && (r->pc() < (ROM_BASE + ROM_AREA_SIZE)) || (r->pc() >= RAMBase) && (r->pc() < (RAMBase + RAMSize)) || (r->pc() >= DR_CACHE_BASE && r->pc() < (DR_CACHE_BASE + DR_CACHE_SIZE)); if (mac_fault) { // "VM settings" during MacOS 8 installation @@ -1632,6 +1632,14 @@ static void sigsegv_handler(int sig, siginfo_t *sip, void *scp) } else if (r->pc() == ROM_BASE + 0x4a10a0 && (r->gpr(20) == 0xf3012002 || r->gpr(20) == 0xf3012000)) { r->pc() += 4; return; + + // MacOS 8.6 serial drivers on startup (with DR Cache and OldWorld ROM) + } else if ((r->pc() - DR_CACHE_BASE) < DR_CACHE_SIZE && (r->gpr(16) == 0xf3012002 || r->gpr(16) == 0xf3012000)) { + r->pc() += 4; + return; + } else if ((r->pc() - DR_CACHE_BASE) < DR_CACHE_SIZE && (r->gpr(20) == 0xf3012002 || r->gpr(20) == 0xf3012000)) { + r->pc() += 4; + return; } // Get opcode and divide into fields diff --git a/SheepShaver/src/emul_op.cpp b/SheepShaver/src/emul_op.cpp index 44ad9137..eddb7f2e 100644 --- a/SheepShaver/src/emul_op.cpp +++ b/SheepShaver/src/emul_op.cpp @@ -288,8 +288,8 @@ void EmulOp(M68kRegisters *r, uint32 pc, int selector) MacOSUtilReset(); AudioReset(); - // Enable DR emulator from NewWorld ROMs - if (ROMType == ROMTYPE_NEWWORLD) { + // Enable DR emulator + if (1) { D(bug("DR activated\n")); WriteMacInt32(KernelDataAddr + 0x17a0, 3); // Prepare for DR emulator activation WriteMacInt32(KernelDataAddr + 0x17c0, DR_CACHE_BASE);