added helper functions to mem_map to convert physical addresses to virtual addresses
This commit is contained in:
parent
f0525a1eb4
commit
b2a6ad52f4
|
@ -53,7 +53,9 @@ enum {
|
|||
HARDWARE_IO_PADDR_END = (HARDWARE_IO_PADDR + HARDWARE_IO_SIZE),
|
||||
HARDWARE_IO_VADDR_END = (HARDWARE_IO_VADDR + HARDWARE_IO_SIZE),
|
||||
|
||||
VRAM_PADDR = 0x18000000,
|
||||
VRAM_VADDR = 0x1F000000,
|
||||
VRAM_PADDR_END = (VRAM_PADDR + VRAM_SIZE),
|
||||
VRAM_VADDR_END = (VRAM_VADDR + VRAM_SIZE),
|
||||
|
||||
SCRATCHPAD_VADDR_END = 0x10000000,
|
||||
|
@ -141,4 +143,16 @@ inline const char* GetCharPointer(const u32 address) {
|
|||
return (const char *)GetPointer(address);
|
||||
}
|
||||
|
||||
inline const u32 VirtualAddressFromPhysical_FCRAM(const u32 address) {
|
||||
return ((address & FCRAM_MASK) | FCRAM_VADDR);
|
||||
}
|
||||
|
||||
inline const u32 VirtualAddressFromPhysical_IO(const u32 address) {
|
||||
return (address + 0x0EB00000);
|
||||
}
|
||||
|
||||
inline const u32 VirtualAddressFromPhysical_VRAM(const u32 address) {
|
||||
return (address + 0x07000000);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -22,7 +22,7 @@ u32 _AddressPhysicalToVirtual(const u32 addr) {
|
|||
// to virtual address translations here. This is obviously quite hacky... But we're not doing
|
||||
// any MMU emulation yet or anything
|
||||
if ((addr >= FCRAM_PADDR) && (addr < FCRAM_PADDR_END)) {
|
||||
return (addr & FCRAM_MASK) | FCRAM_VADDR;
|
||||
return VirtualAddressFromPhysical_FCRAM(addr);
|
||||
|
||||
// Hardware IO
|
||||
// TODO(bunnei): FixMe
|
||||
|
|
Loading…
Reference in New Issue