Don't inline patch function...

This commit is contained in:
Zane Kaminski 2021-04-02 00:43:39 -04:00
parent 34f4cae528
commit a65c7b8707
3 changed files with 9 additions and 12 deletions

Binary file not shown.

Binary file not shown.

21
rdisk.c
View File

@ -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; }