added vram to memory_map

This commit is contained in:
bunnei 2014-04-26 01:27:25 -04:00
parent cb0663de51
commit 86a515e5ac
2 changed files with 15 additions and 8 deletions

View file

@ -51,8 +51,9 @@ enum {
HARDWARE_IO_VADDR = 0x1EC00000, HARDWARE_IO_VADDR = 0x1EC00000,
HARDWARE_IO_VADDR_END = (HARDWARE_IO_VADDR + HARDWARE_IO_SIZE), HARDWARE_IO_VADDR_END = (HARDWARE_IO_VADDR + HARDWARE_IO_SIZE),
VRAM_VADDR = 0x1F000000, VRAM_VADDR = 0x1F000000,
VRAM_VADDR_END = (VRAM_VADDR + VRAM_SIZE),
SCRATCHPAD_VADDR_END = 0x10000000, SCRATCHPAD_VADDR_END = 0x10000000,
SCRATCHPAD_VADDR = (SCRATCHPAD_VADDR_END - SCRATCHPAD_SIZE), ///< Stack space SCRATCHPAD_VADDR = (SCRATCHPAD_VADDR_END - SCRATCHPAD_SIZE), ///< Stack space
}; };

View file

@ -58,8 +58,12 @@ inline void _Read(T &var, const u32 addr) {
} else if ((vaddr >= SHARED_MEMORY_VADDR) && (vaddr < SHARED_MEMORY_VADDR_END)) { } else if ((vaddr >= SHARED_MEMORY_VADDR) && (vaddr < SHARED_MEMORY_VADDR_END)) {
var = *((const T*)&g_shared_mem[vaddr & SHARED_MEMORY_MASK]); var = *((const T*)&g_shared_mem[vaddr & SHARED_MEMORY_MASK]);
// VRAM
} else if ((vaddr >= VRAM_VADDR) && (vaddr < VRAM_VADDR_END)) {
var = *((const T*)&g_vram[vaddr & VRAM_MASK]);
} else { } else {
_assert_msg_(MEMMAP, false, "unknown Read%d @ 0x%08X", sizeof(var) * 8, vaddr); //_assert_msg_(MEMMAP, false, "unknown Read%d @ 0x%08X", sizeof(var) * 8, vaddr);
} }
} }
@ -90,12 +94,10 @@ inline void _Write(u32 addr, const T data) {
} else if ((vaddr >= SHARED_MEMORY_VADDR) && (vaddr < SHARED_MEMORY_VADDR_END)) { } else if ((vaddr >= SHARED_MEMORY_VADDR) && (vaddr < SHARED_MEMORY_VADDR_END)) {
*(T*)&g_shared_mem[vaddr & SHARED_MEMORY_MASK] = data; *(T*)&g_shared_mem[vaddr & SHARED_MEMORY_MASK] = data;
} else if ((vaddr & 0xFF000000) == 0x14000000) { // VRAM
_assert_msg_(MEMMAP, false, "umimplemented write to GSP heap"); } else if ((vaddr >= VRAM_VADDR) && (vaddr < VRAM_VADDR_END)) {
} else if ((vaddr & 0xFFF00000) == 0x1EC00000) { *(T*)&g_vram[vaddr & VRAM_MASK] = data;
_assert_msg_(MEMMAP, false, "umimplemented write to IO registers");
} else if ((vaddr & 0xFF000000) == 0x1F000000) {
_assert_msg_(MEMMAP, false, "umimplemented write to VRAM");
} else if ((vaddr & 0xFFF00000) == 0x1FF00000) { } else if ((vaddr & 0xFFF00000) == 0x1FF00000) {
_assert_msg_(MEMMAP, false, "umimplemented write to DSP memory"); _assert_msg_(MEMMAP, false, "umimplemented write to DSP memory");
} else if ((vaddr & 0xFFFF0000) == 0x1FF80000) { } else if ((vaddr & 0xFFFF0000) == 0x1FF80000) {
@ -125,6 +127,10 @@ u8 *GetPointer(const u32 addr) {
} else if ((vaddr > SHARED_MEMORY_VADDR) && (vaddr < SHARED_MEMORY_VADDR_END)) { } else if ((vaddr > SHARED_MEMORY_VADDR) && (vaddr < SHARED_MEMORY_VADDR_END)) {
return g_shared_mem + (vaddr & SHARED_MEMORY_MASK); return g_shared_mem + (vaddr & SHARED_MEMORY_MASK);
// VRAM
} else if ((vaddr > VRAM_VADDR) && (vaddr < VRAM_VADDR_END)) {
return g_vram + (vaddr & VRAM_MASK);
} else { } else {
ERROR_LOG(MEMMAP, "Unknown GetPointer @ 0x%08x", vaddr); ERROR_LOG(MEMMAP, "Unknown GetPointer @ 0x%08x", vaddr);
return 0; return 0;