diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-07-29 16:54:44 +0200 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-08-16 06:03:46 +0200 |
commit | e2c7954be5ccabc7c5f87000db01cef040ca4b47 (patch) | |
tree | 5b3288c66f6941a9d6be0f2907c3526bb3b7e6ac /src | |
parent | Process: Store kernel compatibility version during loading (diff) | |
download | yuzu-e2c7954be5ccabc7c5f87000db01cef040ca4b47.tar yuzu-e2c7954be5ccabc7c5f87000db01cef040ca4b47.tar.gz yuzu-e2c7954be5ccabc7c5f87000db01cef040ca4b47.tar.bz2 yuzu-e2c7954be5ccabc7c5f87000db01cef040ca4b47.tar.lz yuzu-e2c7954be5ccabc7c5f87000db01cef040ca4b47.tar.xz yuzu-e2c7954be5ccabc7c5f87000db01cef040ca4b47.tar.zst yuzu-e2c7954be5ccabc7c5f87000db01cef040ca4b47.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/core/arm/skyeye_common/armstate.cpp | 1 | ||||
-rw-r--r-- | src/core/arm/skyeye_common/armsupp.cpp | 1 | ||||
-rw-r--r-- | src/core/hle/kernel/resource_limit.cpp | 1 | ||||
-rw-r--r-- | src/core/hle/service/gsp_gpu.cpp | 1 | ||||
-rw-r--r-- | src/core/hle/service/y2r_u.cpp | 1 | ||||
-rw-r--r-- | src/core/mem_map.cpp | 36 | ||||
-rw-r--r-- | src/core/mem_map.h | 11 | ||||
-rw-r--r-- | src/core/memory.cpp | 37 | ||||
-rw-r--r-- | src/core/memory.h | 11 |
9 files changed, 47 insertions, 53 deletions
diff --git a/src/core/arm/skyeye_common/armstate.cpp b/src/core/arm/skyeye_common/armstate.cpp index ccb2eb0eb..0491717dc 100644 --- a/src/core/arm/skyeye_common/armstate.cpp +++ b/src/core/arm/skyeye_common/armstate.cpp @@ -4,7 +4,6 @@ #include "common/swap.h" #include "common/logging/log.h" -#include "core/mem_map.h" #include "core/memory.h" #include "core/arm/skyeye_common/armstate.h" #include "core/arm/skyeye_common/vfp/vfp.h" diff --git a/src/core/arm/skyeye_common/armsupp.cpp b/src/core/arm/skyeye_common/armsupp.cpp index d31fb9449..883713e86 100644 --- a/src/core/arm/skyeye_common/armsupp.cpp +++ b/src/core/arm/skyeye_common/armsupp.cpp @@ -17,7 +17,6 @@ #include "common/logging/log.h" -#include "core/mem_map.h" #include "core/arm/skyeye_common/arm_regformat.h" #include "core/arm/skyeye_common/armstate.h" #include "core/arm/skyeye_common/armsupp.h" diff --git a/src/core/hle/kernel/resource_limit.cpp b/src/core/hle/kernel/resource_limit.cpp index 94b3e3298..67dde08c2 100644 --- a/src/core/hle/kernel/resource_limit.cpp +++ b/src/core/hle/kernel/resource_limit.cpp @@ -6,7 +6,6 @@ #include "common/logging/log.h" -#include "core/mem_map.h" #include "core/hle/kernel/resource_limit.h" namespace Kernel { diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index e93c1b436..5050b9f7d 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp @@ -4,7 +4,6 @@ #include "common/bit_field.h" -#include "core/mem_map.h" #include "core/memory.h" #include "core/hle/kernel/event.h" #include "core/hle/kernel/shared_memory.h" diff --git a/src/core/hle/service/y2r_u.cpp b/src/core/hle/service/y2r_u.cpp index 6e7dafaad..6b1b71fe4 100644 --- a/src/core/hle/service/y2r_u.cpp +++ b/src/core/hle/service/y2r_u.cpp @@ -10,7 +10,6 @@ #include "core/hle/kernel/event.h" #include "core/hle/service/y2r_u.h" #include "core/hw/y2r.h" -#include "core/mem_map.h" #include "video_core/renderer_base.h" #include "video_core/utils.h" diff --git a/src/core/mem_map.cpp b/src/core/mem_map.cpp index c95dea064..f6a063825 100644 --- a/src/core/mem_map.cpp +++ b/src/core/mem_map.cpp @@ -93,42 +93,6 @@ u32 MapBlock_HeapLinear(u32 size, u32 operation, u32 permissions) { return block.GetVirtualAddress(); } -PAddr VirtualToPhysicalAddress(const VAddr addr) { - if (addr == 0) { - return 0; - } else if (addr >= VRAM_VADDR && addr < VRAM_VADDR_END) { - return addr - VRAM_VADDR + VRAM_PADDR; - } else if (addr >= LINEAR_HEAP_VADDR && addr < LINEAR_HEAP_VADDR_END) { - return addr - LINEAR_HEAP_VADDR + FCRAM_PADDR; - } else if (addr >= DSP_RAM_VADDR && addr < DSP_RAM_VADDR_END) { - return addr - DSP_RAM_VADDR + DSP_RAM_PADDR; - } else if (addr >= IO_AREA_VADDR && addr < IO_AREA_VADDR_END) { - return addr - IO_AREA_VADDR + IO_AREA_PADDR; - } - - LOG_ERROR(HW_Memory, "Unknown virtual address @ 0x%08x", addr); - // To help with debugging, set bit on address so that it's obviously invalid. - return addr | 0x80000000; -} - -VAddr PhysicalToVirtualAddress(const PAddr addr) { - if (addr == 0) { - return 0; - } else if (addr >= VRAM_PADDR && addr < VRAM_PADDR_END) { - return addr - VRAM_PADDR + VRAM_VADDR; - } else if (addr >= FCRAM_PADDR && addr < FCRAM_PADDR_END) { - return addr - FCRAM_PADDR + LINEAR_HEAP_VADDR; - } else if (addr >= DSP_RAM_PADDR && addr < DSP_RAM_PADDR_END) { - return addr - DSP_RAM_PADDR + DSP_RAM_VADDR; - } else if (addr >= IO_AREA_PADDR && addr < IO_AREA_PADDR_END) { - return addr - IO_AREA_PADDR + IO_AREA_VADDR; - } - - LOG_ERROR(HW_Memory, "Unknown physical address @ 0x%08x", addr); - // To help with debugging, set bit on address so that it's obviously invalid. - return addr | 0x80000000; -} - void Init() { InitMemoryMap(); LOG_DEBUG(HW_Memory, "initialized OK"); diff --git a/src/core/mem_map.h b/src/core/mem_map.h index 229ef82c5..cba8a0714 100644 --- a/src/core/mem_map.h +++ b/src/core/mem_map.h @@ -32,15 +32,4 @@ u32 MapBlock_Heap(u32 size, u32 operation, u32 permissions); */ u32 MapBlock_HeapLinear(u32 size, u32 operation, u32 permissions); -/** - * Converts a virtual address inside a region with 1:1 mapping to physical memory to a physical - * address. This should be used by services to translate addresses for use by the hardware. - */ -PAddr VirtualToPhysicalAddress(VAddr addr); - -/** - * Undoes a mapping performed by VirtualToPhysicalAddress(). - */ -VAddr PhysicalToVirtualAddress(PAddr addr); - } // namespace diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 1f66bb27d..935dac90f 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -9,7 +9,6 @@ #include "common/logging/log.h" #include "common/swap.h" -#include "core/mem_map.h" #include "core/memory.h" #include "core/memory_setup.h" @@ -198,4 +197,40 @@ void WriteBlock(const VAddr addr, const u8* data, const size_t size) { Write8(addr + offset, data[offset]); } +PAddr VirtualToPhysicalAddress(const VAddr addr) { + if (addr == 0) { + return 0; + } else if (addr >= VRAM_VADDR && addr < VRAM_VADDR_END) { + return addr - VRAM_VADDR + VRAM_PADDR; + } else if (addr >= LINEAR_HEAP_VADDR && addr < LINEAR_HEAP_VADDR_END) { + return addr - LINEAR_HEAP_VADDR + FCRAM_PADDR; + } else if (addr >= DSP_RAM_VADDR && addr < DSP_RAM_VADDR_END) { + return addr - DSP_RAM_VADDR + DSP_RAM_PADDR; + } else if (addr >= IO_AREA_VADDR && addr < IO_AREA_VADDR_END) { + return addr - IO_AREA_VADDR + IO_AREA_PADDR; + } + + LOG_ERROR(HW_Memory, "Unknown virtual address @ 0x%08X", addr); + // To help with debugging, set bit on address so that it's obviously invalid. + return addr | 0x80000000; +} + +VAddr PhysicalToVirtualAddress(const PAddr addr) { + if (addr == 0) { + return 0; + } else if (addr >= VRAM_PADDR && addr < VRAM_PADDR_END) { + return addr - VRAM_PADDR + VRAM_VADDR; + } else if (addr >= FCRAM_PADDR && addr < FCRAM_PADDR_END) { + return addr - FCRAM_PADDR + LINEAR_HEAP_VADDR; + } else if (addr >= DSP_RAM_PADDR && addr < DSP_RAM_PADDR_END) { + return addr - DSP_RAM_PADDR + DSP_RAM_VADDR; + } else if (addr >= IO_AREA_PADDR && addr < IO_AREA_PADDR_END) { + return addr - IO_AREA_PADDR + IO_AREA_VADDR; + } + + LOG_ERROR(HW_Memory, "Unknown physical address @ 0x%08X", addr); + // To help with debugging, set bit on address so that it's obviously invalid. + return addr | 0x80000000; +} + } // namespace diff --git a/src/core/memory.h b/src/core/memory.h index 2a06cc6c3..e6da3e2a5 100644 --- a/src/core/memory.h +++ b/src/core/memory.h @@ -124,6 +124,17 @@ void WriteBlock(VAddr addr, const u8* data, size_t size); u8* GetPointer(VAddr virtual_address); /** +* Converts a virtual address inside a region with 1:1 mapping to physical memory to a physical +* address. This should be used by services to translate addresses for use by the hardware. +*/ +PAddr VirtualToPhysicalAddress(VAddr addr); + +/** +* Undoes a mapping performed by VirtualToPhysicalAddress(). +*/ +VAddr PhysicalToVirtualAddress(PAddr addr); + +/** * Gets a pointer to the memory region beginning at the specified physical address. * * @note This is currently implemented using PhysicalToVirtualAddress(). |