Reinstated 0x10000000 limit on uninstalled memory map for DMA. Removed scratchpad support from toSPR/fromSPR address translation (this is documented as absent).

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2892 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
sudonim1 2010-04-24 20:21:09 +00:00
parent 0f661e8f47
commit 0fa4a5e433
1 changed files with 27 additions and 47 deletions

View File

@ -622,50 +622,32 @@ static __forceinline void setDmacStat(u32 num)
dmacRegs->stat.set_flags(1 << num); dmacRegs->stat.set_flags(1 << num);
} }
static __forceinline bool inScratchpad(u32 addr)
{
return ((addr >=0x70000000) && (addr <= 0x70003fff));
}
// Note: Dma addresses are guaranteed to be aligned to 16 bytes (128 bits) // Note: Dma addresses are guaranteed to be aligned to 16 bytes (128 bits)
static __forceinline tDMA_TAG *SPRdmaGetAddr(u32 addr, bool write) static __forceinline tDMA_TAG *SPRdmaGetAddr(u32 addr, bool write)
{ {
// if (addr & 0xf) { DMA_LOG("*PCSX2*: DMA address not 128bit aligned: %8.8x", addr); } // if (addr & 0xf) { DMA_LOG("*PCSX2*: DMA address not 128bit aligned: %8.8x", addr); }
//Probably dont need these.
if (DMA_TAG(addr).SPR) return (tDMA_TAG*)&psS[addr & 0x3ff0];
// Need to check the physical address as well as just the "SPR" flag, as VTLB doesn't seem to handle it.--refraction
if (inScratchpad(addr))
{
//Console.Warning("Writing to the scratchpad without the SPR flag set!");
return (tDMA_TAG*)&psS[addr & 0x3ff0];
}
// FIXME: Why??? DMA uses physical addresses // FIXME: Why??? DMA uses physical addresses
if ((addr & 0x7ffffff0) >= 0x20000000)
{
Console.Error( "*PCSX2*: DMA error: %8.8x", addr);
return NULL;
}
addr &= 0x1ffffff0; addr &= 0x1ffffff0;
if (addr < Ps2MemSize::Base)
{
return (tDMA_TAG*)&psM[addr];
}
if (addr >= 0x11004000 && addr < 0x11010000) if (addr >= 0x11004000 && addr < 0x11010000)
{ {
//Access for VU Memory //Access for VU Memory
return (tDMA_TAG*)vtlb_GetPhyPtr(addr & 0x1FFFFFF0); return (tDMA_TAG*)vtlb_GetPhyPtr(addr & 0x1FFFFFF0);
} }
if (addr > Ps2MemSize::Base) if (addr >= Ps2MemSize::Base && addr < 0x10000000)
{ {
return (tDMA_TAG*)(write ? psMHW : psMHR); return (tDMA_TAG*)(write ? psMHW : psMHR);
} }
return (tDMA_TAG*)&psM[addr]; Console.Error( "*PCSX2*: DMA error: %8.8x", addr);
return NULL;
} }
// Note: Dma addresses are guaranteed to be aligned to 16 bytes (128 bits) // Note: Dma addresses are guaranteed to be aligned to 16 bytes (128 bits)
@ -675,30 +657,28 @@ static __forceinline tDMA_TAG *dmaGetAddr(u32 addr, bool write)
if (DMA_TAG(addr).SPR) return (tDMA_TAG*)&psS[addr & 0x3ff0]; if (DMA_TAG(addr).SPR) return (tDMA_TAG*)&psS[addr & 0x3ff0];
// Need to check the physical address as well as just the "SPR" flag, as VTLB doesn't seem to handle it.--refraction // FIXME: Why??? DMA uses physical addresses
if (inScratchpad(addr)) addr &= 0x1ffffff0;
if (addr < Ps2MemSize::Base)
{
return (tDMA_TAG*)&psM[addr];
}
// Secret scratchpad address for DMA = end of maximum main memory?
if (addr >= 0x10000000 && addr < 0x10004000)
{ {
//Console.Warning("Writing to the scratchpad without the SPR flag set!"); //Console.Warning("Writing to the scratchpad without the SPR flag set!");
return (tDMA_TAG*)&psS[addr & 0x3ff0]; return (tDMA_TAG*)&psS[addr & 0x3ff0];
} }
// FIXME: Why??? DMA uses physical addresses if (addr >= Ps2MemSize::Base && addr < 0x10000000)
if ((addr & 0x7ffffff0) >= 0x20000000)
{
Console.Error( "*PCSX2*: DMA error: %8.8x", addr);
return NULL;
}
addr &= 0x1ffffff0;
if (addr > Ps2MemSize::Base)
{ {
return (tDMA_TAG*)(write ? psMHW : psMHR); return (tDMA_TAG*)(write ? psMHW : psMHR);
} }
return (tDMA_TAG*)&psM[addr]; Console.Error( "*PCSX2*: DMA error: %8.8x", addr);
return NULL;
} }
void hwIntcIrq(int n); void hwIntcIrq(int n);