diff --git a/bin/driver7M5.bin b/bin/driver7M5.bin index aa512ee..ec49372 100755 Binary files a/bin/driver7M5.bin and b/bin/driver7M5.bin differ diff --git a/bin/rom8M.bin b/bin/rom8M.bin index e8268bc..957951a 100755 Binary files a/bin/rom8M.bin and b/bin/rom8M.bin differ diff --git a/rdisk.c b/rdisk.c index 683511b..6aa874e 100644 --- a/rdisk.c +++ b/rdisk.c @@ -53,7 +53,8 @@ void C24(Ptr sourcePtr, Ptr destPtr, unsigned long byteCount) { } // Switch to 32-bit mode and patch -void P24(Ptr ramdisk, long index, char patch) { +typedef void (*RDiskPatch_t)(Ptr, long, char); +void __attribute__ ((noinline)) P24(Ptr ramdisk, long index, char patch) { if (index < 0) { return; } // Don't patch if index < 0 signed char mode = true32b; SwapMMUMode(&mode); @@ -61,13 +62,6 @@ void P24(Ptr ramdisk, long index, char patch) { SwapMMUMode(&mode); } -typedef void (*RDiskPatch_t)(Ptr, long, char); -static void patch24(Ptr ramdisk, char dbgEN, char cdrEN) { - RDiskPatch_t fun = P24; - if (!dbgEN) { fun(ramdisk, 0x00000031UL, 0x44); } - if (!cdrEN) { fun(ramdisk, 0x00012CAFUL, 0x44); } -} - // Figure out the first available drive number >= 5 static int RDFindDrvNum() { DrvQElPtr dq; @@ -154,8 +148,6 @@ static void RDInit(IOParamPtr p, DCtlPtr d, RDiskStorage_t *c) { BlockMove(RDiskBuf, c->ramdisk, RDiskSize); // Clearing write protect marks RAM disk enabled c->status.writeProt = 0; - // Patch debug and CD-ROM enable bytes - patch24(c->ramdisk, dbgEN, cdrEN); } } else { // 24-bit mode // Put RAM disk just past 8MB @@ -168,11 +160,16 @@ static void RDInit(IOParamPtr p, DCtlPtr d, RDiskStorage_t *c) { copy24(RDiskBuf, c->ramdisk, RDiskSize); // Clearing write protect marks RAM disk enabled c->status.writeProt = 0; - // Patch debug and CD-ROM enable bytes - patch24(c->ramdisk, dbgEN, cdrEN); } } + // Patch debug and CD-ROM enable bytes + if (c->ramdisk) { + RDiskPatch_t fun = P24; + if (!dbgEN) { fun(c->ramdisk, 0x00000031UL, 0x44); } + if (!cdrEN) { fun(c->ramdisk, 0x00012CAFUL, 0x44); } + } + // Unmount if not booting from ROM disk if (unmountEN) { c->status.diskInPlace = 0; }