citra-emu
/
citra
Archived
1
0
Fork 0

Merge pull request #253 from purpasmart96/mem_map

MemMap: Removed I/O address's and added more stuff
This commit is contained in:
bunnei 2014-12-29 21:57:04 -05:00
commit 78bb86293f
2 changed files with 65 additions and 58 deletions

View File

@ -18,8 +18,16 @@ typedef u32 PAddr; ///< Represents a pointer in the physical address space.
enum : u32 { enum : u32 {
BOOTROM_SIZE = 0x00010000, ///< Bootrom (super secret code/data @ 0x8000) 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_SIZE = 0x00002000, ///< MPCore private memory region size
AXI_WRAM_SIZE = 0x00080000, ///< AXI WRAM 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_SIZE = 0x08000000, ///< FCRAM size
FCRAM_PADDR = 0x20000000, ///< FCRAM physical address FCRAM_PADDR = 0x20000000, ///< FCRAM physical address
@ -27,17 +35,26 @@ enum : u32 {
FCRAM_VADDR = 0x08000000, ///< FCRAM virtual address FCRAM_VADDR = 0x08000000, ///< FCRAM virtual address
FCRAM_VADDR_END = (FCRAM_VADDR + FCRAM_SIZE), ///< FCRAM end of virtual space 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_SIZE = 0x04000000, ///< Shared memory size
SHARED_MEMORY_VADDR = 0x10000000, ///< Shared memory SHARED_MEMORY_VADDR = 0x10000000, ///< Shared memory
SHARED_MEMORY_VADDR_END = (SHARED_MEMORY_VADDR + SHARED_MEMORY_SIZE), SHARED_MEMORY_VADDR_END = (SHARED_MEMORY_VADDR + SHARED_MEMORY_SIZE),
DSP_MEMORY_SIZE = 0x00080000, ///< DSP memory size DSP_MEMORY_SIZE = 0x00080000, ///< DSP memory size
DSP_MEMORY_VADDR = 0x1FF00000, ///< DSP memory virtual address 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_SIZE = 0x00001000, ///< Configuration memory size
CONFIG_MEMORY_VADDR = 0x1FF80000, ///< Configuration memory virtual address CONFIG_MEMORY_VADDR = 0x1FF80000, ///< Configuration memory virtual address
CONFIG_MEMORY_VADDR_END = (CONFIG_MEMORY_VADDR + CONFIG_MEMORY_SIZE), 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_SIZE = 0x00001000, ///< Kernel memory size
KERNEL_MEMORY_VADDR = 0xFFFF0000, ///< Kernel memory where the kthread objects etc are KERNEL_MEMORY_VADDR = 0xFFFF0000, ///< Kernel memory where the kthread objects etc are
KERNEL_MEMORY_VADDR_END = (KERNEL_MEMORY_VADDR + KERNEL_MEMORY_SIZE), KERNEL_MEMORY_VADDR_END = (KERNEL_MEMORY_VADDR + KERNEL_MEMORY_SIZE),

View File

@ -58,11 +58,6 @@ inline void Read(T &var, const VAddr vaddr) {
if (vaddr >= KERNEL_MEMORY_VADDR && vaddr < KERNEL_MEMORY_VADDR_END) { if (vaddr >= KERNEL_MEMORY_VADDR && vaddr < KERNEL_MEMORY_VADDR_END) {
var = *((const T*)&g_kernel_mem[vaddr - KERNEL_MEMORY_VADDR]); 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 // ExeFS:/.code is loaded here
} else if ((vaddr >= EXEFS_CODE_VADDR) && (vaddr < EXEFS_CODE_VADDR_END)) { } else if ((vaddr >= EXEFS_CODE_VADDR) && (vaddr < EXEFS_CODE_VADDR_END)) {
var = *((const T*)&g_exefs_code[vaddr - EXEFS_CODE_VADDR]); 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) { if (vaddr >= KERNEL_MEMORY_VADDR && vaddr < KERNEL_MEMORY_VADDR_END) {
*(T*)&g_kernel_mem[vaddr - KERNEL_MEMORY_VADDR] = data; *(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 // ExeFS:/.code is loaded here
} else if ((vaddr >= EXEFS_CODE_VADDR) && (vaddr < EXEFS_CODE_VADDR_END)) { } else if ((vaddr >= EXEFS_CODE_VADDR) && (vaddr < EXEFS_CODE_VADDR_END)) {
*(T*)&g_exefs_code[vaddr - EXEFS_CODE_VADDR] = data; *(T*)&g_exefs_code[vaddr - EXEFS_CODE_VADDR] = data;