From: Gwenole B. <gb...@di...> - 2003-05-20 20:49:00
|
Hi, The following set of workarounds enables me to run MacOS 8.6 correctly under SheepShaver. In order of appearance: - When patching the Shutdown Manager to not call FE0A opcode, it can happen that the bra is not intended here. Indeed, on a NewWorld ROM v1.6, there is a bsr.l to the matched pattern at wp[-2]. For now, I added a check for a beq instruction before patching. - There is a fake SCSI Manager installed. However, for some reason, MacOS insists in injecting some code that makes it access SCSIGlobals natively (with ppc code). I have various traces for volunteers but I gave up for now with this workaround: make SCSIGlobals point to some read-only scratch area. - Someone is overwriting scratch area at 0x0000. Since we don't have SonyVars, it's a good idea to revert to the old value there, i.e. 0x40810000. This is not the proper fix but I failed to analyze this problem better. Only thing I remember is that there is no .Sony driver to replace in this newworld rom. - Restart/Shutdown would always crash for me. I still don't know how we come under such circumstances but it appears that patching the Process Manager (I think that's it according to some webpages) that way makes it work for me. Any thoughts? Bye, Gwenole. Index: src/rom_patches.cpp =================================================================== RCS file: /cvs/SheepShaver/src/rom_patches.cpp,v retrieving revision 1.4 diff -u -b -r1.4 rom_patches.cpp --- src/rom_patches.cpp 17 May 2003 08:42:34 -0000 1.4 +++ src/rom_patches.cpp 20 May 2003 20:31:28 -0000 @@ -2013,7 +2013,7 @@ wp = (uint16 *)(ROM_BASE + base); if (ROMType == ROMTYPE_ZANZIBAR) *wp = htons(M68K_RTS); - else + else if (ntohs(wp[-2] == 0x6700)) wp[-2] = htons(0x6000); // bra // Patch PowerOff() @@ -2134,6 +2134,12 @@ D(bug("Installing drivers...\n")); M68kRegisters r; uint8 pb[SIZEOF_IOParam]; + +#if DISABLE_SCSI + // Fake SCSIGlobals + static const uint8 fake_scsi_globals[32] = {0,}; + WriteMacInt32(0xc0c, (uint32)fake_scsi_globals); +#endif // Open .Sony driver WriteMacInt8((uint32)pb + ioPermssn, 0); Index: src/rsrc_patches.cpp =================================================================== RCS file: /cvs/SheepShaver/src/rsrc_patches.cpp,v retrieving revision 1.2 diff -u -b -r1.2 rsrc_patches.cpp --- src/rsrc_patches.cpp 12 Apr 2003 10:14:07 -0000 1.2 +++ src/rsrc_patches.cpp 20 May 2003 20:31:29 -0000 @@ -319,6 +319,14 @@ // Don't call FE0A opcode (7.6, 7.6.1, 8.0, 8.1, 8.5, 8.6) p[1] = 0x7000; D(bug(" patch 3 applied\n")); + } else if (p[0] == 0x6c00 && p[1] == 0x016a && p[2] == 0x2278 && p[3] == 0x0134) { + // We don't have SonyVars (8.6) + p[-4] = 0x21fc; // move.l $40810000,($0000) + p[-3] = 0x4081; + p[-2] = 0x0000; + p[-1] = 0x0000; + p[0] = 0x6000; + D(bug(" patch 4 applied\n")); } p++; } @@ -479,6 +487,19 @@ break; } p++; + } + + } else if (type == FOURCC('s','c','o','d') && id == -16465) { + D(bug("scod -16465 found\n")); + + // Don't crash in Process Manager on reset/shutdown (8.6) + static const uint8 dat[] = {0x4e, 0x56, 0x00, 0x00, 0x48, 0xe7, 0x03, 0x18, 0x2c, 0x2e, 0x00, 0x10}; + base = find_rsrc_data((uint8 *)p, size, dat, sizeof(dat)); + if (base) { + p16 = (uint16 *)((uint32)p + base); + p16[0] = 0x7000; // moveq #0,d0 + p16[1] = M68K_RTS; + D(bug(" patch 1 applied\n")); } } } |