1
0
Fork 0
forked from suyu/suyu

added mem_map read for config_mem

This commit is contained in:
bunnei 2014-05-06 23:32:04 -04:00
parent 34dc0a9b07
commit a3a383cb7a
2 changed files with 17 additions and 7 deletions

View file

@ -32,6 +32,11 @@ enum {
SHARED_MEMORY_VADDR_END = (SHARED_MEMORY_VADDR + SHARED_MEMORY_SIZE), SHARED_MEMORY_VADDR_END = (SHARED_MEMORY_VADDR + SHARED_MEMORY_SIZE),
SHARED_MEMORY_MASK = (SHARED_MEMORY_SIZE - 1), SHARED_MEMORY_MASK = (SHARED_MEMORY_SIZE - 1),
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),
CONFIG_MEMORY_MASK = (CONFIG_MEMORY_SIZE - 1),
EXEFS_CODE_SIZE = 0x03F00000, EXEFS_CODE_SIZE = 0x03F00000,
EXEFS_CODE_VADDR = 0x00100000, ///< ExeFS:/.code is loaded here EXEFS_CODE_VADDR = 0x00100000, ///< ExeFS:/.code is loaded here
EXEFS_CODE_VADDR_END = (EXEFS_CODE_VADDR + EXEFS_CODE_SIZE), EXEFS_CODE_VADDR_END = (EXEFS_CODE_VADDR + EXEFS_CODE_SIZE),

View file

@ -9,6 +9,7 @@
#include "core/mem_map.h" #include "core/mem_map.h"
#include "core/hw/hw.h" #include "core/hw/hw.h"
#include "hle/hle.h" #include "hle/hle.h"
#include "hle/config_mem.h"
namespace Memory { namespace Memory {
@ -46,7 +47,7 @@ inline void _Read(T &var, const u32 addr) {
// Could just do a base-relative read, too.... TODO // Could just do a base-relative read, too.... TODO
const u32 vaddr = _VirtualAddress(addr); const u32 vaddr = _VirtualAddress(addr);
// Memory allocated for HLE use that can be addressed from the emulated application // Memory allocated for HLE use that can be addressed from the emulated application
// The primary use of this is sharing a commandbuffer between the HLE OS (syscore) and the LLE // The primary use of this is sharing a commandbuffer between the HLE OS (syscore) and the LLE
// core running the user application (appcore) // core running the user application (appcore)
@ -74,6 +75,10 @@ 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]);
// Config memory
} else if ((vaddr >= CONFIG_MEMORY_VADDR) && (vaddr < CONFIG_MEMORY_VADDR_END)) {
ConfigMem::Read<T>(var, vaddr);
// VRAM // VRAM
} else if ((vaddr >= VRAM_VADDR) && (vaddr < VRAM_VADDR_END)) { } else if ((vaddr >= VRAM_VADDR) && (vaddr < VRAM_VADDR_END)) {
var = *((const T*)&g_vram[vaddr & VRAM_MASK]); var = *((const T*)&g_vram[vaddr & VRAM_MASK]);
@ -118,12 +123,12 @@ inline void _Write(u32 addr, const T data) {
} else if ((vaddr >= VRAM_VADDR) && (vaddr < VRAM_VADDR_END)) { } else if ((vaddr >= VRAM_VADDR) && (vaddr < VRAM_VADDR_END)) {
*(T*)&g_vram[vaddr & VRAM_MASK] = data; *(T*)&g_vram[vaddr & VRAM_MASK] = data;
} 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) {
_assert_msg_(MEMMAP, false, "umimplemented write to Configuration Memory"); // _assert_msg_(MEMMAP, false, "umimplemented write to Configuration Memory");
} else if ((vaddr & 0xFFFFF000) == 0x1FF81000) { //} else if ((vaddr & 0xFFFFF000) == 0x1FF81000) {
_assert_msg_(MEMMAP, false, "umimplemented write to shared page"); // _assert_msg_(MEMMAP, false, "umimplemented write to shared page");
// Error out... // Error out...
} else { } else {