ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/rom_patches.cpp
(Generate patch)

Comparing SheepShaver/src/rom_patches.cpp (file contents):
Revision 1.37 by gbeauche, 2004-12-12T18:45:44Z vs.
Revision 1.41 by gbeauche, 2005-03-05T15:44:03Z

# Line 1 | Line 1
1   /*
2   *  rom_patches.cpp - ROM patches
3   *
4 < *  SheepShaver (C) 1997-2004 Christian Bauer and Marc Hellwig
4 > *  SheepShaver (C) 1997-2005 Christian Bauer and Marc Hellwig
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 1085 | Line 1085 | static bool patch_68k_emul(void)
1085          *lp++ = htonl(0x48000000 + 0x36fb00 - base - 8);        // b 0x36fb00 (Reset/FC1E opcode)
1086          *lp++ = htonl(0x48000000 + 0x36fc00 - base - 12);       // FE0A opcode
1087          *lp++ = htonl(POWERPC_ILLEGAL);                                         // Interrupt
1088 <        *lp++ = htonl(POWERPC_ILLEGAL);                                         // ?
1088 >        *lp++ = htonl(0x48000000 + 0x36fd00 - base - 20);       // FE0F opcode
1089          *lp++ = htonl(POWERPC_ILLEGAL);
1090          *lp++ = htonl(POWERPC_ILLEGAL);
1091          *lp++ = htonl(POWERPC_ILLEGAL);
# Line 1254 | Line 1254 | static bool patch_68k_emul(void)
1254          *lp++ = htonl(0x50e7deb4);                                      // rlwimi       r7,r7,27,$00000020
1255          *lp = htonl(0x4e800020);                                        // blr
1256  
1257 +        // Extra routine for FE0F opcode (power management)
1258 +        lp = (uint32 *)(ROMBaseHost + 0x36fd00);
1259 +        *lp++ = htonl(0x7c2903a6);                                      // mtctr        r1
1260 +        *lp++ = htonl(0x80200000 + XLM_IRQ_NEST);       // lwz          r1,XLM_IRQ_NEST
1261 +        *lp++ = htonl(0x38210001);                                      // addi         r1,r1,1
1262 +        *lp++ = htonl(0x90200000 + XLM_IRQ_NEST);       // stw          r1,XLM_IRQ_NEST
1263 +        *lp++ = htonl(0x80200000 + XLM_KERNEL_DATA);// lwz              r1,XLM_KERNEL_DATA
1264 +        *lp++ = htonl(0x90c10018);                                      // stw          r6,0x18(r1)
1265 +        *lp++ = htonl(0x7cc902a6);                                      // mfctr        r6
1266 +        *lp++ = htonl(0x90c10004);                                      // stw          r6,$0004(r1)
1267 +        *lp++ = htonl(0x80c1065c);                                      // lwz          r6,$065c(r1)
1268 +        *lp++ = htonl(0x90e6013c);                                      // stw          r7,$013c(r6)
1269 +        *lp++ = htonl(0x91060144);                                      // stw          r8,$0144(r6)
1270 +        *lp++ = htonl(0x9126014c);                                      // stw          r9,$014c(r6)
1271 +        *lp++ = htonl(0x91460154);                                      // stw          r10,$0154(r6)
1272 +        *lp++ = htonl(0x9166015c);                                      // stw          r11,$015c(r6)
1273 +        *lp++ = htonl(0x91860164);                                      // stw          r12,$0164(r6)
1274 +        *lp++ = htonl(0x91a6016c);                                      // stw          r13,$016c(r6)
1275 +        *lp++ = htonl(0x7da00026);                                      // mfcr         r13
1276 +        *lp++ = htonl(0x80e10660);                                      // lwz          r7,$0660(r1)
1277 +        *lp++ = htonl(0x7d8802a6);                                      // mflr         r12
1278 +        *lp++ = htonl(0x50e74001);                                      // rlwimi.      r7,r7,8,$80000000
1279 +        *lp++ = htonl(0x81410604);                                      // lwz          r10,0x0604(r1)
1280 +        *lp++ = htonl(0x7d4803a6);                                      // mtlr         r10
1281 +        *lp++ = htonl(0x7d8a6378);                                      // mr           r10,r12
1282 +        *lp++ = htonl(0x3d600002);                                      // lis          r11,0x0002
1283 +        *lp++ = htonl(0x616bf072);                                      // ori          r11,r11,0xf072 (MSR)
1284 +        *lp++ = htonl(0x50e7deb4);                                      // rlwimi       r7,r7,27,$00000020
1285 +        *lp = htonl(0x4e800020);                                        // blr
1286 +
1287          // Patch DR emulator to jump to right address when an interrupt occurs
1288          lp = (uint32 *)(ROMBaseHost + 0x370000);
1289          while (lp < (uint32 *)(ROMBaseHost + 0x380000)) {
# Line 1382 | Line 1412 | static bool patch_nanokernel(void)
1412          *lp++ = htonl(POWERPC_NOP);
1413          *lp = htonl(POWERPC_NOP);
1414  
1415 +        // Disable suspend (FE0F opcode)
1416 +        // TODO: really suspend SheepShaver?
1417 +        static const uint8 suspend_dat[] = {0x7c, 0x88, 0x68, 0x39, 0x41, 0x9d};
1418 +        if ((base = find_rom_data(0x315000, 0x316000, suspend_dat, sizeof(suspend_dat))) == 0) return false;
1419 +        D(bug("suspend %08lx\n", base));
1420 +        lp = (uint32 *)(ROMBaseHost + base + 4);
1421 +        *lp = htonl((ntohl(*lp) & 0xffff) | 0x48000000);        // bgt -> b
1422 +
1423          // Patch trap return routine
1424          static const uint8 trap_return_dat[] = {0x80, 0xc1, 0x00, 0x18, 0x80, 0x21, 0x00, 0x04, 0x4c, 0x00, 0x00, 0x64};
1425          if ((base = find_rom_data(0x312000, 0x320000, trap_return_dat, sizeof(trap_return_dat))) == 0) return false;
# Line 2306 | Line 2344 | void InstallDrivers(void)
2344          SheepArray<SIZEOF_IOParam> pb_var;
2345          const uintptr pb = pb_var.addr();
2346  
2347 + #if DISABLE_SCSI
2348 +        // Setup fake SCSI Globals
2349 +        r.d[0] = 0x1000;
2350 +        Execute68kTrap(0xa71e, &r);             // NewPtrSysClear()
2351 +        uint32 scsi_globals = r.a[0];
2352 +        D(bug("Fake SCSI globals at %08lx\n", scsi_globals));
2353 +        WriteMacInt32(0xc0c, scsi_globals);     // Set SCSIGlobals
2354 + #endif
2355 +
2356          // Install floppy driver
2357          if (ROMType == ROMTYPE_NEWWORLD || ROMType == ROMTYPE_GOSSAMER) {
2358  
# Line 2320 | Line 2367 | void InstallDrivers(void)
2367                  WriteMacInt16(dce + dCtlFlags, SonyDriverFlags);
2368          }
2369  
2323 #if DISABLE_SCSI && HAVE_SIGSEGV_SKIP_INSTRUCTION
2324        // Fake SCSIGlobals
2325        WriteMacInt32(0xc0c, SheepMem::ZeroPage());
2326 #endif
2327
2370          // Open .Sony driver
2371          SheepString sony_str("\005.Sony");
2372          WriteMacInt8(pb + ioPermssn, 0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines