summaryrefslogtreecommitdiff
path: root/src/core/mem_map.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/mem_map.h')
-rw-r--r--src/core/mem_map.h163
1 files changed, 88 insertions, 75 deletions
diff --git a/src/core/mem_map.h b/src/core/mem_map.h
index fb582d65a..3866a3a11 100644
--- a/src/core/mem_map.h
+++ b/src/core/mem_map.h
@@ -12,79 +12,93 @@ namespace Memory {
12 12
13const u32 PAGE_SIZE = 0x1000; 13const u32 PAGE_SIZE = 0x1000;
14 14
15enum : u32 { 15/// Physical memory regions as seen from the ARM11
16 BOOTROM_SIZE = 0x00010000, ///< Bootrom (super secret code/data @ 0x8000) size 16enum : PAddr {
17 BOOTROM_PADDR = 0x00000000, ///< Bootrom physical address 17 /// IO register area
18 BOOTROM_PADDR_END = (BOOTROM_PADDR + BOOTROM_SIZE), 18 IO_AREA_PADDR = 0x10100000,
19 19 IO_AREA_SIZE = 0x01000000, ///< IO area size (16MB)
20 BOOTROM_MIRROR_SIZE = 0x00010000, ///< Bootrom Mirror size 20 IO_AREA_PADDR_END = IO_AREA_PADDR + IO_AREA_SIZE,
21 BOOTROM_MIRROR_PADDR = 0x00010000, ///< Bootrom Mirror physical address 21
22 BOOTROM_MIRROR_PADDR_END = (BOOTROM_MIRROR_PADDR + BOOTROM_MIRROR_SIZE), 22 /// MPCore internal memory region
23 23 MPCORE_RAM_PADDR = 0x17E00000,
24 MPCORE_PRIV_SIZE = 0x00002000, ///< MPCore private memory region size 24 MPCORE_RAM_SIZE = 0x00002000, ///< MPCore internal memory size (8KB)
25 MPCORE_PRIV_PADDR = 0x17E00000, ///< MPCore private memory region physical address 25 MPCORE_RAM_PADDR_END = MPCORE_RAM_PADDR + MPCORE_RAM_SIZE,
26 MPCORE_PRIV_PADDR_END = (MPCORE_PRIV_PADDR + MPCORE_PRIV_SIZE), 26
27 27 /// Video memory
28 FCRAM_SIZE = 0x08000000, ///< FCRAM size 28 VRAM_PADDR = 0x18000000,
29 FCRAM_PADDR = 0x20000000, ///< FCRAM physical address 29 VRAM_SIZE = 0x00600000, ///< VRAM size (6MB)
30 FCRAM_PADDR_END = (FCRAM_PADDR + FCRAM_SIZE), 30 VRAM_PADDR_END = VRAM_PADDR + VRAM_SIZE,
31 31
32 HEAP_SIZE = FCRAM_SIZE, ///< Application heap size 32 /// DSP memory
33 HEAP_VADDR = 0x08000000, 33 DSP_RAM_PADDR = 0x1FF00000,
34 HEAP_VADDR_END = (HEAP_VADDR + HEAP_SIZE), 34 DSP_RAM_SIZE = 0x00080000, ///< DSP memory size (512KB)
35 35 DSP_RAM_PADDR_END = DSP_RAM_PADDR + DSP_RAM_SIZE,
36 HEAP_LINEAR_SIZE = FCRAM_SIZE, 36
37 HEAP_LINEAR_VADDR = 0x14000000, 37 /// AXI WRAM
38 HEAP_LINEAR_VADDR_END = (HEAP_LINEAR_VADDR + HEAP_LINEAR_SIZE), 38 AXI_WRAM_PADDR = 0x1FF80000,
39 39 AXI_WRAM_SIZE = 0x00080000, ///< AXI WRAM size (512KB)
40 AXI_WRAM_SIZE = 0x00080000, ///< AXI WRAM size 40 AXI_WRAM_PADDR_END = AXI_WRAM_PADDR + AXI_WRAM_SIZE,
41 AXI_WRAM_PADDR = 0x1FF80000, ///< AXI WRAM physical address 41
42 AXI_WRAM_PADDR_END = (AXI_WRAM_PADDR + AXI_WRAM_SIZE), 42 /// Main FCRAM
43 43 FCRAM_PADDR = 0x20000000,
44 SHARED_MEMORY_SIZE = 0x04000000, ///< Shared memory size 44 FCRAM_SIZE = 0x08000000, ///< FCRAM size (128MB)
45 SHARED_MEMORY_VADDR = 0x10000000, ///< Shared memory 45 FCRAM_PADDR_END = FCRAM_PADDR + FCRAM_SIZE,
46 SHARED_MEMORY_VADDR_END = (SHARED_MEMORY_VADDR + SHARED_MEMORY_SIZE), 46};
47 47
48 DSP_MEMORY_SIZE = 0x00080000, ///< DSP memory size 48/// Virtual user-space memory regions
49 DSP_MEMORY_VADDR = 0x1FF00000, ///< DSP memory virtual address 49enum : VAddr {
50 DSP_MEMORY_VADDR_END = (DSP_MEMORY_VADDR + DSP_MEMORY_SIZE), 50 /// Where the application text, data and bss reside.
51 51 PROCESS_IMAGE_VADDR = 0x00100000,
52 CONFIG_MEMORY_SIZE = 0x00001000, ///< Configuration memory size 52 PROCESS_IMAGE_MAX_SIZE = 0x03F00000,
53 CONFIG_MEMORY_VADDR = 0x1FF80000, ///< Configuration memory virtual address 53 PROCESS_IMAGE_VADDR_END = PROCESS_IMAGE_VADDR + PROCESS_IMAGE_MAX_SIZE,
54 CONFIG_MEMORY_VADDR_END = (CONFIG_MEMORY_VADDR + CONFIG_MEMORY_SIZE), 54
55 55 /// Area where IPC buffers are mapped onto.
56 SHARED_PAGE_SIZE = 0x00001000, ///< Shared page size 56 IPC_MAPPING_VADDR = 0x04000000,
57 SHARED_PAGE_VADDR = 0x1FF81000, ///< Shared page virtual address 57 IPC_MAPPING_SIZE = 0x04000000,
58 SHARED_PAGE_VADDR_END = (SHARED_PAGE_VADDR + SHARED_PAGE_SIZE), 58 IPC_MAPPING_VADDR_END = IPC_MAPPING_VADDR + IPC_MAPPING_SIZE,
59 59
60 KERNEL_MEMORY_SIZE = 0x00001000, ///< Kernel memory size 60 /// Application heap (includes stack).
61 KERNEL_MEMORY_VADDR = 0xFFFF0000, ///< Kernel memory where the kthread objects etc are 61 HEAP_VADDR = 0x08000000,
62 KERNEL_MEMORY_VADDR_END = (KERNEL_MEMORY_VADDR + KERNEL_MEMORY_SIZE), 62 HEAP_SIZE = 0x08000000,
63 63 HEAP_VADDR_END = HEAP_VADDR + HEAP_SIZE,
64 EXEFS_CODE_SIZE = 0x03F00000, 64
65 EXEFS_CODE_VADDR = 0x00100000, ///< ExeFS:/.code is loaded here 65 /// Area where shared memory buffers are mapped onto.
66 EXEFS_CODE_VADDR_END = (EXEFS_CODE_VADDR + EXEFS_CODE_SIZE), 66 SHARED_MEMORY_VADDR = 0x10000000,
67 67 SHARED_MEMORY_SIZE = 0x04000000,
68 // Region of FCRAM used by system 68 SHARED_MEMORY_VADDR_END = SHARED_MEMORY_VADDR + SHARED_MEMORY_SIZE,
69 SYSTEM_MEMORY_SIZE = 0x02C00000, ///< 44MB 69
70 SYSTEM_MEMORY_VADDR = 0x04000000, 70 /// Maps 1:1 to an offset in FCRAM. Used for HW allocations that need to be linear in physical memory.
71 SYSTEM_MEMORY_VADDR_END = (SYSTEM_MEMORY_VADDR + SYSTEM_MEMORY_SIZE), 71 LINEAR_HEAP_VADDR = 0x14000000,
72 72 LINEAR_HEAP_SIZE = 0x08000000,
73 HARDWARE_IO_SIZE = 0x01000000, 73 LINEAR_HEAP_VADDR_END = LINEAR_HEAP_VADDR + LINEAR_HEAP_SIZE,
74 HARDWARE_IO_PADDR = 0x10000000, ///< IO physical address start 74
75 HARDWARE_IO_VADDR = 0x1EC00000, ///< IO virtual address start 75 /// Maps 1:1 to the IO register area.
76 HARDWARE_IO_PADDR_END = (HARDWARE_IO_PADDR + HARDWARE_IO_SIZE), 76 IO_AREA_VADDR = 0x1EC00000,
77 HARDWARE_IO_VADDR_END = (HARDWARE_IO_VADDR + HARDWARE_IO_SIZE), 77 IO_AREA_VADDR_END = IO_AREA_VADDR + IO_AREA_SIZE,
78 78
79 VRAM_SIZE = 0x00600000, 79 /// Maps 1:1 to VRAM.
80 VRAM_PADDR = 0x18000000, 80 VRAM_VADDR = 0x1F000000,
81 VRAM_VADDR = 0x1F000000, 81 VRAM_VADDR_END = VRAM_VADDR + VRAM_SIZE,
82 VRAM_PADDR_END = (VRAM_PADDR + VRAM_SIZE), 82
83 VRAM_VADDR_END = (VRAM_VADDR + VRAM_SIZE), 83 /// Maps 1:1 to DSP memory.
84 84 DSP_RAM_VADDR = 0x1FF00000,
85 SCRATCHPAD_SIZE = 0x00004000, ///< Typical stack size - TODO: Read from exheader 85 DSP_RAM_VADDR_END = DSP_RAM_VADDR + DSP_RAM_SIZE,
86 SCRATCHPAD_VADDR_END = 0x10000000, 86
87 SCRATCHPAD_VADDR = (SCRATCHPAD_VADDR_END - SCRATCHPAD_SIZE), ///< Stack space 87 /// Read-only page containing kernel and system configuration values.
88 CONFIG_MEMORY_VADDR = 0x1FF80000,
89 CONFIG_MEMORY_SIZE = 0x00001000,
90 CONFIG_MEMORY_VADDR_END = CONFIG_MEMORY_VADDR + CONFIG_MEMORY_SIZE,
91
92 /// Usually read-only page containing mostly values read from hardware.
93 SHARED_PAGE_VADDR = 0x1FF81000,
94 SHARED_PAGE_SIZE = 0x00001000,
95 SHARED_PAGE_VADDR_END = SHARED_PAGE_VADDR + SHARED_PAGE_SIZE,
96
97 // TODO(yuriks): The exact location and size of this area is uncomfirmed.
98 /// Area where TLS (Thread-Local Storage) buffers are allocated.
99 TLS_AREA_VADDR = 0x1FFA0000,
100 TLS_AREA_SIZE = 0x00002000, // Each TLS buffer is 0x200 bytes, allows for 16 threads
101 TLS_AREA_VADDR_END = TLS_AREA_VADDR + TLS_AREA_SIZE,
88}; 102};
89 103
90//////////////////////////////////////////////////////////////////////////////////////////////////// 104////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -111,9 +125,8 @@ extern u8* g_heap_linear; ///< Linear heap (main memory)
111extern u8* g_heap; ///< Application heap (main memory) 125extern u8* g_heap; ///< Application heap (main memory)
112extern u8* g_vram; ///< Video memory (VRAM) 126extern u8* g_vram; ///< Video memory (VRAM)
113extern u8* g_shared_mem; ///< Shared memory 127extern u8* g_shared_mem; ///< Shared memory
114extern u8* g_kernel_mem; ///< Kernel memory 128extern u8* g_tls_mem; ///< TLS memory
115extern u8* g_dsp_mem; ///< DSP memory 129extern u8* g_dsp_mem; ///< DSP memory
116extern u8* g_system_mem; ///< System memory
117extern u8* g_exefs_code; ///< ExeFS:/.code is loaded here 130extern u8* g_exefs_code; ///< ExeFS:/.code is loaded here
118 131
119void Init(); 132void Init();