summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2014-12-30 03:57:04 +0100
committerbunnei <bunneidev@gmail.com>2014-12-30 03:57:04 +0100
commit78bb86293f3c04dff4d383f16d5e2d4a5c540a53 (patch)
treecff64cf20a4c84a290d2657f2b9d0de9e47e4ef1
parentMerge pull request #362 from bunnei/dyncom-cleanup (diff)
parentMemMap: Added AXI_WRAM & SHARED_PAGE along with other stuff (diff)
downloadyuzu-78bb86293f3c04dff4d383f16d5e2d4a5c540a53.tar
yuzu-78bb86293f3c04dff4d383f16d5e2d4a5c540a53.tar.gz
yuzu-78bb86293f3c04dff4d383f16d5e2d4a5c540a53.tar.bz2
yuzu-78bb86293f3c04dff4d383f16d5e2d4a5c540a53.tar.lz
yuzu-78bb86293f3c04dff4d383f16d5e2d4a5c540a53.tar.xz
yuzu-78bb86293f3c04dff4d383f16d5e2d4a5c540a53.tar.zst
yuzu-78bb86293f3c04dff4d383f16d5e2d4a5c540a53.zip
-rw-r--r--src/core/mem_map.h135
-rw-r--r--src/core/mem_map_funcs.cpp10
2 files changed, 76 insertions, 69 deletions
diff --git a/src/core/mem_map.h b/src/core/mem_map.h
index e63e81a4b..a2ef9d3af 100644
--- a/src/core/mem_map.h
+++ b/src/core/mem_map.h
@@ -17,67 +17,84 @@ typedef u32 PAddr; ///< Represents a pointer in the physical address space.
////////////////////////////////////////////////////////////////////////////////////////////////////
enum : u32 {
- BOOTROM_SIZE = 0x00010000, ///< Bootrom (super secret code/data @ 0x8000) size
- MPCORE_PRIV_SIZE = 0x00002000, ///< MPCore private memory region size
- AXI_WRAM_SIZE = 0x00080000, ///< AXI WRAM size
-
- FCRAM_SIZE = 0x08000000, ///< FCRAM size
- FCRAM_PADDR = 0x20000000, ///< FCRAM physical address
- FCRAM_PADDR_END = (FCRAM_PADDR + FCRAM_SIZE), ///< FCRAM end of physical space
- FCRAM_VADDR = 0x08000000, ///< FCRAM virtual address
- FCRAM_VADDR_END = (FCRAM_VADDR + FCRAM_SIZE), ///< FCRAM end of virtual space
-
- SHARED_MEMORY_SIZE = 0x04000000, ///< Shared memory size
- SHARED_MEMORY_VADDR = 0x10000000, ///< Shared memory
- SHARED_MEMORY_VADDR_END = (SHARED_MEMORY_VADDR + SHARED_MEMORY_SIZE),
-
- DSP_MEMORY_SIZE = 0x00080000, ///< DSP memory size
- DSP_MEMORY_VADDR = 0x1FF00000, ///< DSP memory virtual address
-
- CONFIG_MEMORY_SIZE = 0x00001000, ///< Configuration memory size
- CONFIG_MEMORY_VADDR = 0x1FF80000, ///< Configuration memory virtual address
- CONFIG_MEMORY_VADDR_END = (CONFIG_MEMORY_VADDR + CONFIG_MEMORY_SIZE),
-
- KERNEL_MEMORY_SIZE = 0x00001000, ///< Kernel memory size
- KERNEL_MEMORY_VADDR = 0xFFFF0000, ///< Kernel memory where the kthread objects etc are
- KERNEL_MEMORY_VADDR_END = (KERNEL_MEMORY_VADDR + KERNEL_MEMORY_SIZE),
-
- EXEFS_CODE_SIZE = 0x03F00000,
- EXEFS_CODE_VADDR = 0x00100000, ///< ExeFS:/.code is loaded here
- EXEFS_CODE_VADDR_END = (EXEFS_CODE_VADDR + EXEFS_CODE_SIZE),
+ BOOTROM_SIZE = 0x00010000, ///< Bootrom (super secret code/data @ 0x8000) size
+ BOOTROM_PADDR = 0x00000000, ///< Bootrom physical address
+ BOOTROM_PADDR_END = (BOOTROM_PADDR + BOOTROM_SIZE),
+
+ BOOTROM_MIRROR_SIZE = 0x00010000, ///< Bootrom Mirror size
+ BOOTROM_MIRROR_PADDR = 0x00010000, ///< Bootrom Mirror physical address
+ BOOTROM_MIRROR_PADDR_END = (BOOTROM_MIRROR_PADDR + BOOTROM_MIRROR_SIZE),
+
+ MPCORE_PRIV_SIZE = 0x00002000, ///< MPCore private memory region size
+ MPCORE_PRIV_PADDR = 0x17E00000, ///< MPCore private memory region physical address
+ MPCORE_PRIV_PADDR_END = (MPCORE_PRIV_PADDR + MPCORE_PRIV_SIZE),
+
+ FCRAM_SIZE = 0x08000000, ///< FCRAM size
+ FCRAM_PADDR = 0x20000000, ///< FCRAM physical address
+ FCRAM_PADDR_END = (FCRAM_PADDR + FCRAM_SIZE), ///< FCRAM end of physical space
+ FCRAM_VADDR = 0x08000000, ///< FCRAM virtual address
+ FCRAM_VADDR_END = (FCRAM_VADDR + FCRAM_SIZE), ///< FCRAM end of virtual space
+
+ AXI_WRAM_SIZE = 0x00080000, ///< AXI WRAM size
+ AXI_WRAM_PADDR = 0x1FF80000, ///< AXI WRAM physical address
+ AXI_WRAM_PADDR_END = (AXI_WRAM_PADDR + AXI_WRAM_SIZE),
+
+ SHARED_MEMORY_SIZE = 0x04000000, ///< Shared memory size
+ SHARED_MEMORY_VADDR = 0x10000000, ///< Shared memory
+ SHARED_MEMORY_VADDR_END = (SHARED_MEMORY_VADDR + SHARED_MEMORY_SIZE),
+
+ DSP_MEMORY_SIZE = 0x00080000, ///< DSP memory size
+ DSP_MEMORY_VADDR = 0x1FF00000, ///< DSP memory virtual address
+ DSP_MEMORY_VADDR_END = (DSP_MEMORY_VADDR + DSP_MEMORY_SIZE),
+
+ CONFIG_MEMORY_SIZE = 0x00001000, ///< Configuration memory size
+ CONFIG_MEMORY_VADDR = 0x1FF80000, ///< Configuration memory virtual address
+ CONFIG_MEMORY_VADDR_END = (CONFIG_MEMORY_VADDR + CONFIG_MEMORY_SIZE),
+
+ SHARED_PAGE_SIZE = 0x00001000, ///< Shared page size
+ SHARED_PAGE_VADDR = 0x1FF81000, ///< Shared page virtual address
+ SHARED_PAGE_VADDR_END = (SHARED_PAGE_VADDR + SHARED_PAGE_SIZE),
+
+ KERNEL_MEMORY_SIZE = 0x00001000, ///< Kernel memory size
+ KERNEL_MEMORY_VADDR = 0xFFFF0000, ///< Kernel memory where the kthread objects etc are
+ KERNEL_MEMORY_VADDR_END = (KERNEL_MEMORY_VADDR + KERNEL_MEMORY_SIZE),
+
+ EXEFS_CODE_SIZE = 0x03F00000,
+ EXEFS_CODE_VADDR = 0x00100000, ///< ExeFS:/.code is loaded here
+ EXEFS_CODE_VADDR_END = (EXEFS_CODE_VADDR + EXEFS_CODE_SIZE),
// Region of FCRAM used by system
- SYSTEM_MEMORY_SIZE = 0x02C00000, ///< 44MB
- SYSTEM_MEMORY_VADDR = 0x04000000,
- SYSTEM_MEMORY_VADDR_END = (SYSTEM_MEMORY_VADDR + SYSTEM_MEMORY_SIZE),
-
- HEAP_SIZE = FCRAM_SIZE, ///< Application heap size
- //HEAP_PADDR = HEAP_GSP_SIZE,
- //HEAP_PADDR_END = (HEAP_PADDR + HEAP_SIZE),
- HEAP_VADDR = 0x08000000,
- HEAP_VADDR_END = (HEAP_VADDR + HEAP_SIZE),
-
- HEAP_LINEAR_SIZE = 0x08000000, ///< Linear heap size... TODO: Define correctly?
- HEAP_LINEAR_VADDR = 0x14000000,
- HEAP_LINEAR_VADDR_END = (HEAP_LINEAR_VADDR + HEAP_LINEAR_SIZE),
- HEAP_LINEAR_PADDR = 0x00000000,
- HEAP_LINEAR_PADDR_END = (HEAP_LINEAR_PADDR + HEAP_LINEAR_SIZE),
-
- HARDWARE_IO_SIZE = 0x01000000,
- HARDWARE_IO_PADDR = 0x10000000, ///< IO physical address start
- HARDWARE_IO_VADDR = 0x1EC00000, ///< IO virtual address start
- HARDWARE_IO_PADDR_END = (HARDWARE_IO_PADDR + HARDWARE_IO_SIZE),
- HARDWARE_IO_VADDR_END = (HARDWARE_IO_VADDR + HARDWARE_IO_SIZE),
-
- VRAM_SIZE = 0x00600000,
- VRAM_PADDR = 0x18000000,
- VRAM_VADDR = 0x1F000000,
- VRAM_PADDR_END = (VRAM_PADDR + VRAM_SIZE),
- VRAM_VADDR_END = (VRAM_VADDR + VRAM_SIZE),
-
- SCRATCHPAD_SIZE = 0x00004000, ///< Typical stack size - TODO: Read from exheader
- SCRATCHPAD_VADDR_END = 0x10000000,
- SCRATCHPAD_VADDR = (SCRATCHPAD_VADDR_END - SCRATCHPAD_SIZE), ///< Stack space
+ SYSTEM_MEMORY_SIZE = 0x02C00000, ///< 44MB
+ SYSTEM_MEMORY_VADDR = 0x04000000,
+ SYSTEM_MEMORY_VADDR_END = (SYSTEM_MEMORY_VADDR + SYSTEM_MEMORY_SIZE),
+
+ HEAP_SIZE = FCRAM_SIZE, ///< Application heap size
+ //HEAP_PADDR = HEAP_GSP_SIZE,
+ //HEAP_PADDR_END = (HEAP_PADDR + HEAP_SIZE),
+ HEAP_VADDR = 0x08000000,
+ HEAP_VADDR_END = (HEAP_VADDR + HEAP_SIZE),
+
+ HEAP_LINEAR_SIZE = 0x08000000, ///< Linear heap size... TODO: Define correctly?
+ HEAP_LINEAR_VADDR = 0x14000000,
+ HEAP_LINEAR_VADDR_END = (HEAP_LINEAR_VADDR + HEAP_LINEAR_SIZE),
+ HEAP_LINEAR_PADDR = 0x00000000,
+ HEAP_LINEAR_PADDR_END = (HEAP_LINEAR_PADDR + HEAP_LINEAR_SIZE),
+
+ HARDWARE_IO_SIZE = 0x01000000,
+ HARDWARE_IO_PADDR = 0x10000000, ///< IO physical address start
+ HARDWARE_IO_VADDR = 0x1EC00000, ///< IO virtual address start
+ HARDWARE_IO_PADDR_END = (HARDWARE_IO_PADDR + HARDWARE_IO_SIZE),
+ HARDWARE_IO_VADDR_END = (HARDWARE_IO_VADDR + HARDWARE_IO_SIZE),
+
+ VRAM_SIZE = 0x00600000,
+ VRAM_PADDR = 0x18000000,
+ VRAM_VADDR = 0x1F000000,
+ VRAM_PADDR_END = (VRAM_PADDR + VRAM_SIZE),
+ VRAM_VADDR_END = (VRAM_VADDR + VRAM_SIZE),
+
+ SCRATCHPAD_SIZE = 0x00004000, ///< Typical stack size - TODO: Read from exheader
+ SCRATCHPAD_VADDR_END = 0x10000000,
+ SCRATCHPAD_VADDR = (SCRATCHPAD_VADDR_END - SCRATCHPAD_SIZE), ///< Stack space
};
////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp
index 0f378eaee..fdf382ed6 100644
--- a/src/core/mem_map_funcs.cpp
+++ b/src/core/mem_map_funcs.cpp
@@ -58,11 +58,6 @@ inline void Read(T &var, const VAddr vaddr) {
if (vaddr >= KERNEL_MEMORY_VADDR && vaddr < KERNEL_MEMORY_VADDR_END) {
var = *((const T*)&g_kernel_mem[vaddr - KERNEL_MEMORY_VADDR]);
- // Hardware I/O register reads
- // 0x10XXXXXX- is physical address space, 0x1EXXXXXX is virtual address space
- } else if ((vaddr >= HARDWARE_IO_VADDR) && (vaddr < HARDWARE_IO_VADDR_END)) {
- HW::Read<T>(var, vaddr);
-
// ExeFS:/.code is loaded here
} else if ((vaddr >= EXEFS_CODE_VADDR) && (vaddr < EXEFS_CODE_VADDR_END)) {
var = *((const T*)&g_exefs_code[vaddr - EXEFS_CODE_VADDR]);
@@ -103,11 +98,6 @@ inline void Write(const VAddr vaddr, const T data) {
if (vaddr >= KERNEL_MEMORY_VADDR && vaddr < KERNEL_MEMORY_VADDR_END) {
*(T*)&g_kernel_mem[vaddr - KERNEL_MEMORY_VADDR] = data;
- // Hardware I/O register writes
- // 0x10XXXXXX- is physical address space, 0x1EXXXXXX is virtual address space
- } else if ((vaddr >= HARDWARE_IO_VADDR) && (vaddr < HARDWARE_IO_VADDR_END)) {
- HW::Write<T>(vaddr, data);
-
// ExeFS:/.code is loaded here
} else if ((vaddr >= EXEFS_CODE_VADDR) && (vaddr < EXEFS_CODE_VADDR_END)) {
*(T*)&g_exefs_code[vaddr - EXEFS_CODE_VADDR] = data;