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.12 by gbeauche, 2003-10-05T23:38:07Z vs.
Revision 1.17 by gbeauche, 2003-10-07T19:28:09Z

# Line 58 | Line 58
58  
59  
60   // Other ROM addresses
61 < const uint32 CHECK_LOAD_PATCH_SPACE = 0x2f7f00;
62 < const uint32 PUT_SCRAP_PATCH_SPACE = 0x2f7f80;
63 < const uint32 GET_SCRAP_PATCH_SPACE = 0x2f7fc0;
64 < const uint32 ADDR_MAP_PATCH_SPACE = 0x2f8000;
61 > const uint32 CHECK_LOAD_PATCH_SPACE = 0x2fcf00;
62 > const uint32 PUT_SCRAP_PATCH_SPACE = 0x2fcf80;
63 > const uint32 GET_SCRAP_PATCH_SPACE = 0x2fcfc0;
64 > const uint32 ADDR_MAP_PATCH_SPACE = 0x2fd000;
65  
66   // Global variables
67   int ROMType;                            // ROM type
# Line 131 | Line 131 | void decode_parcels(const uint8 *src, ui
131                            (parcel_type >> 8) & 0xff, parcel_type & 0xff, &parcel_data[6]));
132                  if (parcel_type == FOURCC('r','o','m',' ')) {
133                          uint32 lzss_offset  = ntohl(parcel_data[2]);
134 <                        uint32 lzss_size = ((uint32)src + parcel_offset) - ((uint32)parcel_data + lzss_offset);
134 >                        uint32 lzss_size = ((uintptr)src + next_offset) - ((uintptr)parcel_data + lzss_offset);
135                          decode_lzss((uint8 *)parcel_data + lzss_offset, dest, lzss_size);
136                  }
137                  parcel_offset = next_offset;
# Line 725 | Line 725 | bool PatchROM(void)
725          else
726                  return false;
727  
728 +        // Check that other ROM addresses point to really free regions
729 +        if (ntohl(*(uint32 *)(ROM_BASE + CHECK_LOAD_PATCH_SPACE)) != 0x6b636b63)
730 +                return false;
731 +        if (ntohl(*(uint32 *)(ROM_BASE + PUT_SCRAP_PATCH_SPACE)) != 0x6b636b63)
732 +                return false;
733 +        if (ntohl(*(uint32 *)(ROM_BASE + GET_SCRAP_PATCH_SPACE)) != 0x6b636b63)
734 +                return false;
735 +        if (ntohl(*(uint32 *)(ROM_BASE + ADDR_MAP_PATCH_SPACE)) != 0x6b636b63)
736 +                return false;
737 +
738          // Apply patches
739          if (!patch_nanokernel_boot()) return false;
740          if (!patch_68k_emul()) return false;
# Line 1842 | Line 1852 | static bool patch_68k(void)
1852          *wp = htons(M68K_RTS);
1853  
1854          // Don't install Time Manager task for 60Hz interrupt (Enable60HzInts, via 0x2b8)
1855 <        if (ROMType == ROMTYPE_NEWWORLD) {
1855 >        if (ROMType == ROMTYPE_NEWWORLD || ROMType == ROMTYPE_GOSSAMER) {
1856                  static const uint8 tm_task_dat[] = {0x30, 0x3c, 0x4e, 0x2b, 0xa9, 0xc9};
1857 <                if ((base = find_rom_data(0x2e0, 0x320, tm_task_dat, sizeof(tm_task_dat))) == 0) return false;
1857 >                if ((base = find_rom_data(0x2a0, 0x320, tm_task_dat, sizeof(tm_task_dat))) == 0) return false;
1858                  D(bug("tm_task %08lx\n", base));
1859 <                wp = (uint16 *)(ROM_BASE + base + 28); // FIXME: this is not right for all nw ROMs
1859 >                wp = (uint16 *)(ROM_BASE + base + 28);
1860                  *wp++ = htons(M68K_NOP);
1861                  *wp++ = htons(M68K_NOP);
1862                  *wp++ = htons(M68K_NOP);
1863                  *wp++ = htons(M68K_NOP);
1864                  *wp++ = htons(M68K_NOP);
1865                  *wp = htons(M68K_NOP);
1856        } else if (ROMType == ROMTYPE_GOSSAMER) {
1857                static const uint8 tm_task_dat[] = {0x30, 0x3c, 0x4e, 0x2b, 0xa9, 0xc9};
1858                if ((base = find_rom_data(0x2a0, 0x2e0, tm_task_dat, sizeof(tm_task_dat))) == 0) return false;
1859                D(bug("tm_task %08lx\n", base));
1860                wp = (uint16 *)(ROM_BASE + base + 28);
1861                *wp++ = htons(M68K_NOP);
1862                *wp++ = htons(M68K_NOP);
1863                *wp++ = htons(M68K_NOP);
1866          } else {
1867                  static const uint8 tm_task_dat[] = {0x20, 0x3c, 0x73, 0x79, 0x73, 0x61};
1868                  if ((base = find_rom_data(0x280, 0x300, tm_task_dat, sizeof(tm_task_dat))) == 0) return false;
# Line 2238 | Line 2240 | void InstallDrivers(void)
2240          uint8 pb[SIZEOF_IOParam];
2241  
2242          // Install floppy driver
2243 <        if (ROMType == ROMTYPE_NEWWORLD) {
2243 >        if (ROMType == ROMTYPE_NEWWORLD || ROMType == ROMTYPE_GOSSAMER) {
2244  
2245 <                // Force installation of floppy driver with NewWorld ROMs
2245 >                // Force installation of floppy driver with NewWorld and Gossamer ROMs
2246                  r.a[0] = ROM_BASE + sony_offset;
2247                  r.d[0] = (uint32)SonyRefNum;
2248                  Execute68kTrap(0xa43d, &r);             // DrvrInstallRsrvMem()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines