summaryrefslogtreecommitdiffstats
path: root/src/core/arm/skyeye_common
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/arm/skyeye_common')
-rw-r--r--src/core/arm/skyeye_common/armstate.cpp35
-rw-r--r--src/core/arm/skyeye_common/armstate.h2
2 files changed, 37 insertions, 0 deletions
diff --git a/src/core/arm/skyeye_common/armstate.cpp b/src/core/arm/skyeye_common/armstate.cpp
index 0491717dc..2d814345a 100644
--- a/src/core/arm/skyeye_common/armstate.cpp
+++ b/src/core/arm/skyeye_common/armstate.cpp
@@ -7,6 +7,7 @@
#include "core/memory.h"
#include "core/arm/skyeye_common/armstate.h"
#include "core/arm/skyeye_common/vfp/vfp.h"
+#include "core/gdbstub/gdbstub.h"
ARMul_State::ARMul_State(PrivilegeMode initial_mode)
{
@@ -185,8 +186,25 @@ void ARMul_State::ResetMPCoreCP15Registers()
CP15[CP15_TLB_DEBUG_CONTROL] = 0x00000000;
}
+static void CheckMemoryBreakpoint(u32 address, GDBStub::BreakpointType type)
+{
+ if (GDBStub::g_server_enabled && GDBStub::CheckBreakpoint(address, type)) {
+ LOG_DEBUG(Debug, "Found memory breakpoint @ %08x", address);
+ GDBStub::Break(true);
+ }
+}
+
+u8 ARMul_State::ReadMemory8(u32 address) const
+{
+ CheckMemoryBreakpoint(address, GDBStub::BreakpointType::Read);
+
+ return Memory::Read8(address);
+}
+
u16 ARMul_State::ReadMemory16(u32 address) const
{
+ CheckMemoryBreakpoint(address, GDBStub::BreakpointType::Read);
+
u16 data = Memory::Read16(address);
if (InBigEndianMode())
@@ -197,6 +215,8 @@ u16 ARMul_State::ReadMemory16(u32 address) const
u32 ARMul_State::ReadMemory32(u32 address) const
{
+ CheckMemoryBreakpoint(address, GDBStub::BreakpointType::Read);
+
u32 data = Memory::Read32(address);
if (InBigEndianMode())
@@ -207,6 +227,8 @@ u32 ARMul_State::ReadMemory32(u32 address) const
u64 ARMul_State::ReadMemory64(u32 address) const
{
+ CheckMemoryBreakpoint(address, GDBStub::BreakpointType::Read);
+
u64 data = Memory::Read64(address);
if (InBigEndianMode())
@@ -215,8 +237,17 @@ u64 ARMul_State::ReadMemory64(u32 address) const
return data;
}
+void ARMul_State::WriteMemory8(u32 address, u8 data)
+{
+ CheckMemoryBreakpoint(address, GDBStub::BreakpointType::Write);
+
+ Memory::Write8(address, data);
+}
+
void ARMul_State::WriteMemory16(u32 address, u16 data)
{
+ CheckMemoryBreakpoint(address, GDBStub::BreakpointType::Write);
+
if (InBigEndianMode())
data = Common::swap16(data);
@@ -225,6 +256,8 @@ void ARMul_State::WriteMemory16(u32 address, u16 data)
void ARMul_State::WriteMemory32(u32 address, u32 data)
{
+ CheckMemoryBreakpoint(address, GDBStub::BreakpointType::Write);
+
if (InBigEndianMode())
data = Common::swap32(data);
@@ -233,6 +266,8 @@ void ARMul_State::WriteMemory32(u32 address, u32 data)
void ARMul_State::WriteMemory64(u32 address, u64 data)
{
+ CheckMemoryBreakpoint(address, GDBStub::BreakpointType::Write);
+
if (InBigEndianMode())
data = Common::swap64(data);
diff --git a/src/core/arm/skyeye_common/armstate.h b/src/core/arm/skyeye_common/armstate.h
index b364e2621..c0536c02f 100644
--- a/src/core/arm/skyeye_common/armstate.h
+++ b/src/core/arm/skyeye_common/armstate.h
@@ -153,9 +153,11 @@ public:
// Reads/writes data in big/little endian format based on the
// state of the E (endian) bit in the APSR.
+ u8 ReadMemory8(u32 address) const;
u16 ReadMemory16(u32 address) const;
u32 ReadMemory32(u32 address) const;
u64 ReadMemory64(u32 address) const;
+ void WriteMemory8(u32 address, u8 data);
void WriteMemory16(u32 address, u16 data);
void WriteMemory32(u32 address, u32 data);
void WriteMemory64(u32 address, u64 data);