mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-12-27 00:29:40 +00:00
EMUL_OP_BLOCK_MOVE is no longer used to replace the BlockMove() routine but
to implement more clever cache flushing for it
This commit is contained in:
parent
efc60c7f60
commit
82b38333f1
@ -523,8 +523,8 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
|
||||
break;
|
||||
#endif
|
||||
|
||||
case M68K_EMUL_OP_BLOCK_MOVE: // BlockMove() replacement
|
||||
memmove(Mac2HostAddr(r->a[1]), Mac2HostAddr(r->a[0]), r->d[0]);
|
||||
case M68K_EMUL_OP_BLOCK_MOVE: // BlockMove() cache flushing
|
||||
FlushCodeCache(Mac2HostAddr(r->a[0]), r->a[1]);
|
||||
break;
|
||||
|
||||
case M68K_EMUL_OP_DEBUGUTIL:
|
||||
|
@ -1240,7 +1240,7 @@ static bool patch_rom_32(void)
|
||||
#endif
|
||||
|
||||
#if !ROM_IS_WRITE_PROTECTED
|
||||
#if defined(AMIGA) || defined(USE_SCRATCHMEM_SUBTERFUGE)
|
||||
#if defined(USE_SCRATCHMEM_SUBTERFUGE)
|
||||
// Set fake handle at 0x0000 to scratch memory area (so broken Mac programs won't write into Mac ROM)
|
||||
extern uint8 *ScratchMem;
|
||||
const uint32 ScratchMemBase = Host2MacAddr(ScratchMem);
|
||||
@ -1462,12 +1462,14 @@ static bool patch_rom_32(void)
|
||||
if (ROMSize > 0x80000) {
|
||||
|
||||
// BlockMove()
|
||||
static const uint8 ptest_dat[] = {0xa0, 0x8d, 0x0c, 0x81, 0x00, 0x00, 0x0c, 0x00, 0x6d, 0x06, 0x4e, 0x71, 0xf4, 0xf8};
|
||||
base = find_rom_data(0x87000, 0x87800, ptest_dat, sizeof(ptest_dat));
|
||||
D(bug("ptest %08lx\n", base));
|
||||
static const uint8 bmove_dat[] = {0x20, 0x5f, 0x22, 0x5f, 0x0c, 0x38, 0x00, 0x04, 0x01, 0x2f};
|
||||
base = find_rom_data(0x87000, 0x87800, bmove_dat, sizeof(bmove_dat));
|
||||
D(bug("block_move %08lx\n", base));
|
||||
if (base) { // ROM15/22/23/26/27/32
|
||||
wp = (uint16 *)(ROMBaseHost + base + 8);
|
||||
*wp = htons(M68K_NOP);
|
||||
wp = (uint16 *)(ROMBaseHost + base + 4);
|
||||
*wp++ = htons(M68K_EMUL_OP_BLOCK_MOVE);
|
||||
*wp++ = htons(0x7000);
|
||||
*wp = htons(M68K_RTS);
|
||||
}
|
||||
|
||||
// SANE
|
||||
@ -1599,14 +1601,6 @@ static bool patch_rom_32(void)
|
||||
*wp++ = htons(base >> 16);
|
||||
*wp = htons(base & 0xffff);
|
||||
|
||||
#if EMULATED_68K
|
||||
// Replace BlockMove()
|
||||
wp = (uint16 *)(ROMBaseHost + find_rom_trap(0xa02e)); // BlockMove()
|
||||
*wp++ = htons(M68K_EMUL_OP_BLOCK_MOVE);
|
||||
*wp++ = htons(0x7000);
|
||||
*wp = htons(M68K_RTS);
|
||||
#endif
|
||||
|
||||
// Look for double PACK 4 resources
|
||||
if ((base = find_rom_resource(FOURCC('P','A','C','K'), 4)) == 0) return false;
|
||||
if ((base = find_rom_resource(FOURCC('P','A','C','K'), 4, true)) == 0 && FPUType == 0)
|
||||
|
@ -461,12 +461,14 @@ void CheckLoad(uint32 type, int16 id, uint8 *p, uint32 size)
|
||||
D(bug(" gpch 750 found\n"));
|
||||
|
||||
// Don't use PTEST instruction in BlockMove() (7.5, 7.6, 7.6.1, 8.0)
|
||||
static const uint8 dat[] = {0xa0, 0x8d, 0x0c, 0x81, 0x00, 0x00, 0x0c, 0x00, 0x65, 0x06, 0x4e, 0x71, 0xf4, 0xf8};
|
||||
static const uint8 dat[] = {0x20, 0x5f, 0x22, 0x5f, 0x0c, 0x38, 0x00, 0x04, 0x01, 0x2f};
|
||||
base = find_rsrc_data(p, size, dat, sizeof(dat));
|
||||
if (base) {
|
||||
p16 = (uint16 *)(p + base + 8);
|
||||
*p16 = htons(M68K_NOP);
|
||||
FlushCodeCache(p + base + 8, 2);
|
||||
p16 = (uint16 *)(p + base + 4);
|
||||
*p16++ = htons(M68K_EMUL_OP_BLOCK_MOVE);
|
||||
*p16++ = htons(0x7000);
|
||||
*p16 = htons(M68K_RTS);
|
||||
FlushCodeCache(p + base + 4, 6);
|
||||
D(bug(" patch 1 applied\n"));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user