summaryrefslogtreecommitdiffstats
path: root/src/core/arm/skyeye_common/armmmu.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-03-20 02:37:43 +0100
committerbunnei <bunneidev@gmail.com>2015-03-20 02:37:43 +0100
commit1981aa3d7e8c230f05999393a891c89105575b12 (patch)
tree0f2e2db10ba2b96bda11b4538aaaba7cdbd3536b /src/core/arm/skyeye_common/armmmu.h
parentMerge pull request #667 from archshift/wut (diff)
parentdyncom: Make Load/Store instructions support big endian (diff)
downloadyuzu-1981aa3d7e8c230f05999393a891c89105575b12.tar
yuzu-1981aa3d7e8c230f05999393a891c89105575b12.tar.gz
yuzu-1981aa3d7e8c230f05999393a891c89105575b12.tar.bz2
yuzu-1981aa3d7e8c230f05999393a891c89105575b12.tar.lz
yuzu-1981aa3d7e8c230f05999393a891c89105575b12.tar.xz
yuzu-1981aa3d7e8c230f05999393a891c89105575b12.tar.zst
yuzu-1981aa3d7e8c230f05999393a891c89105575b12.zip
Diffstat (limited to 'src/core/arm/skyeye_common/armmmu.h')
-rw-r--r--src/core/arm/skyeye_common/armmmu.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/core/arm/skyeye_common/armmmu.h b/src/core/arm/skyeye_common/armmmu.h
index 6e54142ee..0f9eadafa 100644
--- a/src/core/arm/skyeye_common/armmmu.h
+++ b/src/core/arm/skyeye_common/armmmu.h
@@ -20,6 +20,9 @@
#pragma once
+#include "core/mem_map.h"
+#include "core/arm/skyeye_common/armdefs.h"
+
// Register numbers in the MMU
enum
{
@@ -54,3 +57,55 @@ enum
XSCALE_CP15_AUX_CONTROL = 1,
XSCALE_CP15_COPRO_ACCESS = 15,
};
+
+// Reads data in big/little endian format based on the
+// state of the E (endian) bit in the emulated CPU's APSR.
+inline u16 ReadMemory16(ARMul_State* cpu, u32 address) {
+ u16 data = Memory::Read16(address);
+
+ if (InBigEndianMode(cpu))
+ data = Common::swap16(data);
+
+ return data;
+}
+
+inline u32 ReadMemory32(ARMul_State* cpu, u32 address) {
+ u32 data = Memory::Read32(address);
+
+ if (InBigEndianMode(cpu))
+ data = Common::swap32(data);
+
+ return data;
+}
+
+inline u64 ReadMemory64(ARMul_State* cpu, u32 address) {
+ u64 data = Memory::Read64(address);
+
+ if (InBigEndianMode(cpu))
+ data = Common::swap64(data);
+
+ return data;
+}
+
+// Writes data in big/little endian format based on the
+// state of the E (endian) bit in the emulated CPU's APSR.
+inline void WriteMemory16(ARMul_State* cpu, u32 address, u16 data) {
+ if (InBigEndianMode(cpu))
+ data = Common::swap16(data);
+
+ Memory::Write16(address, data);
+}
+
+inline void WriteMemory32(ARMul_State* cpu, u32 address, u32 data) {
+ if (InBigEndianMode(cpu))
+ data = Common::swap32(data);
+
+ Memory::Write32(address, data);
+}
+
+inline void WriteMemory64(ARMul_State* cpu, u32 address, u64 data) {
+ if (InBigEndianMode(cpu))
+ data = Common::swap64(data);
+
+ Memory::Write64(address, data);
+}