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.23 by gbeauche, 2003-12-15T15:27:01Z vs.
Revision 1.29 by gbeauche, 2004-05-31T09:04:42Z

# Line 1 | Line 1
1   /*
2   *  rom_patches.cpp - ROM patches
3   *
4 < *  SheepShaver (C) 1997-2002 Christian Bauer and Marc Hellwig
4 > *  SheepShaver (C) 1997-2004 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 871 | Line 871 | static bool patch_nanokernel_boot(void)
871                          lp[8] = htonl(0x00800002);      // TLB total size/TLB assoc
872                          break;
873   //              case 11:        // X704?
874 <                case 12:        // ???
874 >                case 12:        // 7400, 7410
875 >                case 0x800c:
876                          lp[0] = htonl(0x1000);          // Page size
877                          lp[1] = htonl(0x8000);          // Data cache size
878                          lp[2] = htonl(0x8000);          // Inst cache size
# Line 1057 | Line 1058 | static bool patch_nanokernel_boot(void)
1058   static bool patch_68k_emul(void)
1059   {
1060          uint32 *lp;
1061 <        uint32 base;
1061 >        uint32 base, loc;
1062  
1063          // Overwrite twi instructions
1064          static const uint8 twi_dat[] = {0x0f, 0xff, 0x00, 0x00, 0x0f, 0xff, 0x00, 0x01, 0x0f, 0xff, 0x00, 0x02};
# Line 1265 | Line 1266 | static bool patch_68k_emul(void)
1266          return false;
1267   dr_found:
1268          lp++;
1269 <        *lp = htonl(0x48000000 + 0xf000 - (((uint32)lp - ROM_BASE) & 0xffff));          // b    DR_CACHE_BASE+0x1f000
1270 <        lp = (uint32 *)(ROM_BASE + 0x37f000);
1271 <        *lp++ = htonl(0x3c000000 + ((ROM_BASE + 0x46d0a4) >> 16));              // lis  r0,xxx
1272 <        *lp++ = htonl(0x60000000 + ((ROM_BASE + 0x46d0a4) & 0xffff));   // ori  r0,r0,xxx
1273 <        *lp++ = htonl(0x7c0903a6);                                                                              // mtctr        r0
1274 <        *lp = htonl(POWERPC_BCTR);                                                                              // bctr
1269 >        loc = (uint32)lp - ROM_BASE;
1270 >        if ((base = powerpc_branch_target(ROM_BASE + loc)) == 0) base = ROM_BASE + loc;
1271 >        static const uint8 dr_ret_dat[] = {0x80, 0xbf, 0x08, 0x14, 0x53, 0x19, 0x4d, 0xac, 0x7c, 0xa8, 0x03, 0xa6};
1272 >        if ((base = find_rom_data(base - ROM_BASE, 0x380000, dr_ret_dat, sizeof(dr_ret_dat))) == 0) return false;
1273 >        D(bug("dr_ret %08lx\n", base));
1274 >        if (base != loc) {
1275 >                // OldWorld ROMs contain an absolute branch
1276 >                D(bug(" patching absolute branch at %08x\n", (uint32)lp - ROM_BASE));
1277 >                *lp = htonl(0x48000000 + 0xf000 - (((uint32)lp - ROM_BASE) & 0xffff));          // b    DR_CACHE_BASE+0x1f000
1278 >                lp = (uint32 *)(ROM_BASE + 0x37f000);
1279 >                *lp++ = htonl(0x3c000000 + ((ROM_BASE + base) >> 16));                  // lis  r0,xxx
1280 >                *lp++ = htonl(0x60000000 + ((ROM_BASE + base) & 0xffff));               // ori  r0,r0,xxx
1281 >                *lp++ = htonl(0x7c0803a6);                                                                              // mtlr r0
1282 >                *lp = htonl(POWERPC_BLR);                                                                               // blr
1283 >        }
1284          return true;
1285   }
1286  
# Line 2227 | Line 2237 | static bool patch_68k(void)
2237          lp = (uint32 *)(ROM_BASE + ntohl(*lp));
2238          lp[0xa9fd & 0x3ff] = htonl(GET_SCRAP_PATCH_SPACE);
2239  
2230 #if __BEOS__
2240          // Patch SynchIdleTime()
2241          if (PrefsFindBool("idlewait")) {
2242                  wp = (uint16 *)(ROM_BASE + find_rom_trap(0xabf7) + 4);  // SynchIdleTime()
2243                  D(bug("SynchIdleTime at %08lx\n", wp));
2244 <                if (ntohs(*wp) == 0x2078) {
2244 >                if (ntohs(*wp) == 0x2078) {                                                             // movea.l      ExpandMem,a0
2245                          *wp++ = htons(M68K_EMUL_OP_IDLE_TIME);
2246                          *wp = htons(M68K_NOP);
2247 <                } else {
2247 >                }
2248 >                else if (ntohs(*wp) == 0x70fe)                                                  // moveq        #-2,d0
2249 >                        *wp++ = htons(M68K_EMUL_OP_IDLE_TIME_2);
2250 >                else {
2251                          D(bug("SynchIdleTime patch not installed\n"));
2252                  }
2253          }
2242 #endif
2254  
2255          // Construct list of all sifters used by sound components in ROM
2256          D(bug("Searching for sound components with type sdev in ROM\n"));
# Line 2304 | Line 2315 | void InstallDrivers(void)
2315                  WriteMacInt16(dce + dCtlFlags, SonyDriverFlags);
2316          }
2317  
2318 < #if DISABLE_SCSI && 0
2318 > #if DISABLE_SCSI && HAVE_SIGSEGV_SKIP_INSTRUCTION
2319          // Fake SCSIGlobals
2320          WriteMacInt32(0xc0c, SheepMem::ZeroPage());
2321   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines