aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar bunnei <ericbunnie@gmail.com>2014-03-25 10:50:34 -0400
committerGravatar bunnei <ericbunnie@gmail.com>2014-03-25 10:50:34 -0400
commit20807c4d5aad14f45df9944ed0b8c62a05b42143 (patch)
treea6c78fd0589ec841b57ab6b0c38164023814f962 /src/core
parent97e4d9f2110c638eb484fbaa352b69f3f9561aaa (diff)
added a GetPointer function to Memory for use with ELF loading
Diffstat (limited to 'src/core')
-rw-r--r--src/core/src/mem_map.cpp2
-rw-r--r--src/core/src/mem_map.h5
-rw-r--r--src/core/src/mem_map_funcs.cpp56
3 files changed, 33 insertions, 30 deletions
diff --git a/src/core/src/mem_map.cpp b/src/core/src/mem_map.cpp
index eab4051e..e7b50857 100644
--- a/src/core/src/mem_map.cpp
+++ b/src/core/src/mem_map.cpp
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2013 Citrus Emulator
+ * Copyright (C) 2014 Citra Emulator
*
* @file mem_map.cpp
* @author ShizZy <shizzy247@gmail.com>
diff --git a/src/core/src/mem_map.h b/src/core/src/mem_map.h
index 38004042..48137a19 100644
--- a/src/core/src/mem_map.h
+++ b/src/core/src/mem_map.h
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2013 Citrus Emulator
+ * Copyright (C) 2014 Citra Emulator
*
* @file mem_map.h
* @author ShizZy <shizzy247@gmail.com>
@@ -39,6 +39,7 @@
#define MEM_AXI_WRAM_SIZE 0x00080000 ///< AXI WRAM size
#define MEM_FCRAM_SIZE 0x08000000 ///< FCRAM size
+#define MEM_VRAM_MASK 0x007FFFFF
#define MEM_FCRAM_MASK (MEM_FCRAM_SIZE - 1) ///< FCRAm mask
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -74,6 +75,8 @@ void Write8(const u32 addr, const u32 data);
void Write16(const u32 addr, const u32 data);
void Write32(const u32 addr, const u32 data);
+u8* GetPointer(const u32 Address);
+
} // namespace
////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/src/mem_map_funcs.cpp b/src/core/src/mem_map_funcs.cpp
index d1739d72..f00d10f8 100644
--- a/src/core/src/mem_map_funcs.cpp
+++ b/src/core/src/mem_map_funcs.cpp
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2013 Citrus Emulator
+ * Copyright (C) 2014 Citra Emulator
*
* @file mem_map_funcs.cpp
* @author ShizZy <shizzy247@gmail.com>
@@ -28,33 +28,6 @@
namespace Memory {
-/*
-u8 *GetPointer(const u32 addr)
-{
- if ((addr & 0x3E000000) == 0x08000000) {
- return g_fcram + (addr & MEM_FCRAM_MASK);
- }
- else if ((addr & 0x3F800000) == 0x04000000) {
- return m_pVRAM + (addr & VRAM_MASK);
- }
- else if ((addr & 0x3F000000) >= 0x08000000 && (addr & 0x3F000000) < 0x08000000 + g_MemorySize) {
- return m_pRAM + (addr & g_MemoryMask);
- }
- else {
- ERROR_LOG(MEMMAP, "Unknown GetPointer %08x PC %08x LR %08x", addr, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);
- static bool reported = false;
- if (!reported) {
- Reporting::ReportMessage("Unknown GetPointer %08x PC %08x LR %08x", addr, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);
- reported = true;
- }
- if (!g_Config.bIgnoreBadMemAccess) {
- Core_EnableStepping(true);
- host->SetDebugMode(true);
- }
- return 0;
- }
-}*/
-
template <typename T>
inline void ReadFromHardware(T &var, const u32 addr)
{
@@ -125,6 +98,33 @@ bool IsValidAddress(const u32 addr) {
}
}
+u8 *GetPointer(const u32 addr) {
+ // TODO(bunnei): Just a stub for now... ImplementMe!
+ if ((addr & 0x3E000000) == 0x08000000) {
+ return g_fcram + (addr & MEM_FCRAM_MASK);
+ }
+ //else if ((addr & 0x3F800000) == 0x04000000) {
+ // return g_vram + (addr & MEM_VRAM_MASK);
+ //}
+ //else if ((addr & 0x3F000000) >= 0x08000000 && (addr & 0x3F000000) < 0x08000000 + g_MemorySize) {
+ // return m_pRAM + (addr & g_MemoryMask);
+ //}
+ else {
+ //ERROR_LOG(MEMMAP, "Unknown GetPointer %08x PC %08x LR %08x", addr, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);
+ ERROR_LOG(MEMMAP, "Unknown GetPointer %08x", addr);
+ static bool reported = false;
+ //if (!reported) {
+ // Reporting::ReportMessage("Unknown GetPointer %08x PC %08x LR %08x", addr, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);
+ // reported = true;
+ //}
+ //if (!g_Config.bIgnoreBadMemAccess) {
+ // Core_EnableStepping(true);
+ // host->SetDebugMode(true);
+ //}
+ return 0;
+ }
+}
+
u8 Read8(const u32 addr) {
u8 _var = 0;
ReadFromHardware<u8>(_var, addr);