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.20 by gbeauche, 2003-12-14T14:23:46Z vs.
Revision 1.21 by gbeauche, 2003-12-15T15:23:59Z

# Line 62 | Line 62
62   const uint32 CHECK_LOAD_PATCH_SPACE = 0x2fcf00;
63   const uint32 PUT_SCRAP_PATCH_SPACE = 0x2fcf80;
64   const uint32 GET_SCRAP_PATCH_SPACE = 0x2fcfc0;
65 < const uint32 ADDR_MAP_PATCH_SPACE = 0x2fd000;
65 > const uint32 ADDR_MAP_PATCH_SPACE = 0x2fd100;
66  
67   // Global variables
68   int ROMType;                            // ROM type
# Line 311 | Line 311 | static uint32 find_rom_powerpc_branch(ui
311  
312  
313   /*
314 + *  Check that requested ROM patch space is really available
315 + */
316 +
317 + static bool check_rom_patch_space(uint32 base, uint32 size)
318 + {
319 +        size = (size + 3) & -4;
320 +        for (int i = 0; i < size; i += 4) {
321 +                uint32 x = ntohl(*(uint32 *)(ROM_BASE + base + i));
322 +                printf("%08x\n", x);
323 +                if (x != 0x6b636b63 && x != 0)
324 +                        return false;
325 +        }
326 +        return true;
327 + }
328 +
329 +
330 + /*
331   *  List of audio sifters installed in ROM and System file
332   */
333  
# Line 697 | Line 714 | bool PatchROM(void)
714                  return false;
715  
716          // Check that other ROM addresses point to really free regions
717 <        if (ntohl(*(uint32 *)(ROM_BASE + CHECK_LOAD_PATCH_SPACE)) != 0x6b636b63)
717 >        if (!check_rom_patch_space(CHECK_LOAD_PATCH_SPACE, 0x40))
718                  return false;
719 <        if (ntohl(*(uint32 *)(ROM_BASE + PUT_SCRAP_PATCH_SPACE)) != 0x6b636b63)
719 >        if (!check_rom_patch_space(PUT_SCRAP_PATCH_SPACE, 0x40))
720                  return false;
721 <        if (ntohl(*(uint32 *)(ROM_BASE + GET_SCRAP_PATCH_SPACE)) != 0x6b636b63)
721 >        if (!check_rom_patch_space(GET_SCRAP_PATCH_SPACE, 0x40))
722                  return false;
723 <        if (ntohl(*(uint32 *)(ROM_BASE + ADDR_MAP_PATCH_SPACE)) != 0x6b636b63)
723 >        if (!check_rom_patch_space(ADDR_MAP_PATCH_SPACE - 10 * 4, 0x100))
724                  return false;
725  
726          // Apply patches
# Line 1646 | Line 1663 | static bool patch_68k(void)
1663          D(bug("scc_init_caller %08lx\n", base + 12));
1664          wp = (uint16 *)(ROM_BASE + base + 12);
1665          loc = ntohs(wp[1]) + ((uintptr)wp - ROM_BASE) + 2;
1666 <        static const uint8 scc_init_dat[] = {0x08, 0x38, 0x00, 0x03, 0x0d, 0xd3, 0x67, 0x12, 0x20, 0x78, 0x01, 0xdc, 0x22, 0x78, 0x01, 0xd8};
1666 >        static const uint8 scc_init_dat[] = {0x20, 0x78, 0x01, 0xdc, 0x22, 0x78, 0x01, 0xd8};
1667          if ((base = find_rom_data(loc, loc + 0x80, scc_init_dat, sizeof(scc_init_dat))) != loc) return false;
1668          D(bug("scc_init %08lx\n", base));
1669          wp = (uint16 *)(ROM_BASE + base);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines