Don't trap write accesses to datastream pointers & friends in CDF / BUS.

This commit is contained in:
Christian Speckner 2017-12-05 20:28:41 +01:00
parent f18fa0fcb8
commit 2b5416eade
2 changed files with 24 additions and 22 deletions

View File

@ -226,28 +226,7 @@ void Thumbulator::write16(uInt32 addr, uInt32 data)
if((addr > 0x40001fff) && (addr < 0x50000000))
fatalError("write16", addr, "abort - out of range");
switch(configuration)
{
// this protects 2K Harmony/Melody Drivers
// Initial section of driver is the bootstrap which copies the driver
// from ROM to RAM, so it can safely be used by the custom ARM code
// as additional RAM
case ConfigureFor::BUS:
case ConfigureFor::CDF:
case ConfigureFor::CDF1:
if((addr > 0x40000028) && (addr < 0x40000800))
fatalError("write16", addr, "to bankswitch code area");
break;
// this protects 3K Harmony/Melody Drivers
// Initial section of driver is the bootstrap which copies the driver
// from ROM to RAM, so it can safely be used by the custom ARM code
// as additional RAM
case ConfigureFor::DPCplus:
if((addr > 0x40000028) && (addr < 0x40000c00))
fatalError("write16", addr, "to bankswitch code area");
break;
}
if (isProtected(addr)) fatalError("write16", addr, "to driver area");
if(addr & 1)
fatalError("write16", addr, "abort - misaligned");
@ -281,6 +260,7 @@ void Thumbulator::write32(uInt32 addr, uInt32 data)
if(addr & 3)
fatalError("write32", addr, "abort - misaligned");
if (isProtected(addr)) fatalError("write32", addr, "to driver area");
DO_DBUG(statusMsg << "write32(" << Base::HEX8 << addr << "," << Base::HEX8 << data << ")" << endl);
switch(addr & 0xF0000000)
@ -356,6 +336,27 @@ void Thumbulator::write32(uInt32 addr, uInt32 data)
fatalError("write32", addr, data, "abort");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Thumbulator::isProtected(uInt32 addr)
{
if (addr < 0x40000000) return false;
addr -= 0x40000000;
switch (configuration) {
case ConfigureFor::DPCplus:
return (addr < 0x0c00) && (addr > 0x0028);
case ConfigureFor::CDF:
return (addr < 0x0800) && (addr > 0x0028) && !((addr >= 0x06e0) && (addr < (0x0e60 + 284)));
case ConfigureFor::CDF1:
return (addr < 0x0800) && (addr > 0x0028) && !((addr >= 0x00a0) && (addr < (0x00a0 + 284)));
case ConfigureFor::BUS:
return (addr < 0x06d8) && (addr > 0x0028);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 Thumbulator::read16(uInt32 addr)
{

View File

@ -104,6 +104,7 @@ class Thumbulator
uInt32 fetch32(uInt32 addr);
uInt32 read16(uInt32 addr);
uInt32 read32(uInt32 addr);
bool isProtected(uInt32 addr);
void write16(uInt32 addr, uInt32 data);
void write32(uInt32 addr, uInt32 data);
void updateTimer(uInt32 cycles);