summaryrefslogtreecommitdiff
path: root/src/core/arm/skyeye_common
diff options
context:
space:
mode:
authorGravatar Lioncash2015-07-27 21:40:48 -0400
committerGravatar Lioncash2015-07-27 22:06:59 -0400
commita507ea23c157abfc490cbb0c85154b23c4b079b9 (patch)
tree910750e7ce0cca0da06820b992175d3bf12ad872 /src/core/arm/skyeye_common
parentdyncom: Remove duplicated typedef and extern (diff)
downloadyuzu-a507ea23c157abfc490cbb0c85154b23c4b079b9.tar.gz
yuzu-a507ea23c157abfc490cbb0c85154b23c4b079b9.tar.xz
yuzu-a507ea23c157abfc490cbb0c85154b23c4b079b9.zip
dyncom: Migrate exclusive memory access control into armstate
Diffstat (limited to 'src/core/arm/skyeye_common')
-rw-r--r--src/core/arm/skyeye_common/armstate.h25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/core/arm/skyeye_common/armstate.h b/src/core/arm/skyeye_common/armstate.h
index 88c1dab9d..b364e2621 100644
--- a/src/core/arm/skyeye_common/armstate.h
+++ b/src/core/arm/skyeye_common/armstate.h
@@ -163,6 +163,19 @@ public:
163 u32 ReadCP15Register(u32 crn, u32 opcode_1, u32 crm, u32 opcode_2) const; 163 u32 ReadCP15Register(u32 crn, u32 opcode_1, u32 crm, u32 opcode_2) const;
164 void WriteCP15Register(u32 value, u32 crn, u32 opcode_1, u32 crm, u32 opcode_2); 164 void WriteCP15Register(u32 value, u32 crn, u32 opcode_1, u32 crm, u32 opcode_2);
165 165
166 // Exclusive memory access functions
167 bool IsExclusiveMemoryAccess(u32 address) const {
168 return exclusive_state && exclusive_tag == (address & RESERVATION_GRANULE_MASK);
169 }
170 void SetExclusiveMemoryAddress(u32 address) {
171 exclusive_tag = address & RESERVATION_GRANULE_MASK;
172 exclusive_state = true;
173 }
174 void UnsetExclusiveMemoryAddress() {
175 exclusive_tag = 0xFFFFFFFF;
176 exclusive_state = false;
177 }
178
166 // Whether or not the given CPU is in big endian mode (E bit is set) 179 // Whether or not the given CPU is in big endian mode (E bit is set)
167 bool InBigEndianMode() const { 180 bool InBigEndianMode() const {
168 return (Cpsr & (1 << 9)) != 0; 181 return (Cpsr & (1 << 9)) != 0;
@@ -203,9 +216,6 @@ public:
203 216
204 u32 Mode; // The current mode 217 u32 Mode; // The current mode
205 u32 Bank; // The current register bank 218 u32 Bank; // The current register bank
206 u32 exclusive_tag; // The address for which the local monitor is in exclusive access mode
207 u32 exclusive_state;
208 u32 exclusive_result;
209 219
210 u32 NFlag, ZFlag, CFlag, VFlag, IFFlags; // Dummy flags for speed 220 u32 NFlag, ZFlag, CFlag, VFlag, IFFlags; // Dummy flags for speed
211 unsigned int shifter_carry_out; 221 unsigned int shifter_carry_out;
@@ -230,4 +240,13 @@ public:
230 240
231private: 241private:
232 void ResetMPCoreCP15Registers(); 242 void ResetMPCoreCP15Registers();
243
244 // Defines a reservation granule of 2 words, which protects the first 2 words starting at the tag.
245 // This is the smallest granule allowed by the v7 spec, and is coincidentally just large enough to
246 // support LDR/STREXD.
247 static const u32 RESERVATION_GRANULE_MASK = 0xFFFFFFF8;
248
249 u32 exclusive_tag; // The address for which the local monitor is in exclusive access mode
250 u32 exclusive_result;
251 bool exclusive_state;
233}; 252};