diff options
| author | 2014-04-27 12:40:31 -0400 | |
|---|---|---|
| committer | 2014-04-27 12:40:31 -0400 | |
| commit | b2a6ad52f4a059b66e2a0ea12813ce968fa04277 (patch) | |
| tree | aff9bf7cdb3c4a620708f7c9911a0d7b1c126153 /src | |
| parent | added code to LCD modules keep track of framebuffer location in FCRAM or VRAM (diff) | |
| download | yuzu-b2a6ad52f4a059b66e2a0ea12813ce968fa04277.tar.gz yuzu-b2a6ad52f4a059b66e2a0ea12813ce968fa04277.tar.xz yuzu-b2a6ad52f4a059b66e2a0ea12813ce968fa04277.zip | |
added helper functions to mem_map to convert physical addresses to virtual addresses
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/mem_map.h | 14 | ||||
| -rw-r--r-- | src/core/mem_map_funcs.cpp | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/core/mem_map.h b/src/core/mem_map.h index 1a49cc98d..c744e377e 100644 --- a/src/core/mem_map.h +++ b/src/core/mem_map.h | |||
| @@ -53,7 +53,9 @@ enum { | |||
| 53 | HARDWARE_IO_PADDR_END = (HARDWARE_IO_PADDR + HARDWARE_IO_SIZE), | 53 | HARDWARE_IO_PADDR_END = (HARDWARE_IO_PADDR + HARDWARE_IO_SIZE), |
| 54 | HARDWARE_IO_VADDR_END = (HARDWARE_IO_VADDR + HARDWARE_IO_SIZE), | 54 | HARDWARE_IO_VADDR_END = (HARDWARE_IO_VADDR + HARDWARE_IO_SIZE), |
| 55 | 55 | ||
| 56 | VRAM_PADDR = 0x18000000, | ||
| 56 | VRAM_VADDR = 0x1F000000, | 57 | VRAM_VADDR = 0x1F000000, |
| 58 | VRAM_PADDR_END = (VRAM_PADDR + VRAM_SIZE), | ||
| 57 | VRAM_VADDR_END = (VRAM_VADDR + VRAM_SIZE), | 59 | VRAM_VADDR_END = (VRAM_VADDR + VRAM_SIZE), |
| 58 | 60 | ||
| 59 | SCRATCHPAD_VADDR_END = 0x10000000, | 61 | SCRATCHPAD_VADDR_END = 0x10000000, |
| @@ -141,4 +143,16 @@ inline const char* GetCharPointer(const u32 address) { | |||
| 141 | return (const char *)GetPointer(address); | 143 | return (const char *)GetPointer(address); |
| 142 | } | 144 | } |
| 143 | 145 | ||
| 146 | inline const u32 VirtualAddressFromPhysical_FCRAM(const u32 address) { | ||
| 147 | return ((address & FCRAM_MASK) | FCRAM_VADDR); | ||
| 148 | } | ||
| 149 | |||
| 150 | inline const u32 VirtualAddressFromPhysical_IO(const u32 address) { | ||
| 151 | return (address + 0x0EB00000); | ||
| 152 | } | ||
| 153 | |||
| 154 | inline const u32 VirtualAddressFromPhysical_VRAM(const u32 address) { | ||
| 155 | return (address + 0x07000000); | ||
| 156 | } | ||
| 157 | |||
| 144 | } // namespace | 158 | } // namespace |
diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp index d0bec31c6..c8daf0df5 100644 --- a/src/core/mem_map_funcs.cpp +++ b/src/core/mem_map_funcs.cpp | |||
| @@ -22,7 +22,7 @@ u32 _AddressPhysicalToVirtual(const u32 addr) { | |||
| 22 | // to virtual address translations here. This is obviously quite hacky... But we're not doing | 22 | // to virtual address translations here. This is obviously quite hacky... But we're not doing |
| 23 | // any MMU emulation yet or anything | 23 | // any MMU emulation yet or anything |
| 24 | if ((addr >= FCRAM_PADDR) && (addr < FCRAM_PADDR_END)) { | 24 | if ((addr >= FCRAM_PADDR) && (addr < FCRAM_PADDR_END)) { |
| 25 | return (addr & FCRAM_MASK) | FCRAM_VADDR; | 25 | return VirtualAddressFromPhysical_FCRAM(addr); |
| 26 | 26 | ||
| 27 | // Hardware IO | 27 | // Hardware IO |
| 28 | // TODO(bunnei): FixMe | 28 | // TODO(bunnei): FixMe |