Memory: Support more regions in the VAddr-PAddr translation functions

Also adds better documentation and removes the one-off reimplementation
of the function in pica.h.
This commit is contained in:
Yuri Kunde Schlesner 2015-05-09 03:08:11 -03:00
parent e7b6ed7578
commit 28a9e4c1d5
7 changed files with 45 additions and 51 deletions

View file

@ -998,15 +998,4 @@ union CommandHeader {
BitField<31, 1, u32> group_commands;
};
// TODO: Ugly, should fix PhysicalToVirtualAddress instead
inline static u32 PAddrToVAddr(u32 addr) {
if (addr >= Memory::VRAM_PADDR && addr < Memory::VRAM_PADDR + Memory::VRAM_SIZE) {
return addr - Memory::VRAM_PADDR + Memory::VRAM_VADDR;
} else if (addr >= Memory::FCRAM_PADDR && addr < Memory::FCRAM_PADDR + Memory::FCRAM_SIZE) {
return addr - Memory::FCRAM_PADDR + Memory::LINEAR_HEAP_VADDR;
} else {
return 0;
}
}
} // namespace