summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/arm/arm_interface.h15
-rw-r--r--src/core/arm/dyncom/arm_dyncom.cpp8
-rw-r--r--src/core/arm/dyncom/arm_dyncom.h2
-rw-r--r--src/core/arm/dyncom/arm_dyncom_interpreter.cpp1
-rw-r--r--src/core/arm/interpreter/arminit.cpp61
-rw-r--r--src/core/arm/interpreter/armsupp.cpp217
-rw-r--r--src/core/arm/skyeye_common/arm_regformat.h40
-rw-r--r--src/core/arm/skyeye_common/armdefs.h2
-rw-r--r--src/core/core.cpp5
9 files changed, 217 insertions, 134 deletions
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h
index fe1e584ad..310663774 100644
--- a/src/core/arm/arm_interface.h
+++ b/src/core/arm/arm_interface.h
@@ -6,6 +6,7 @@
6 6
7#include "common/common.h" 7#include "common/common.h"
8#include "common/common_types.h" 8#include "common/common_types.h"
9#include "core/arm/skyeye_common/arm_regformat.h"
9 10
10namespace Core { 11namespace Core {
11 struct ThreadContext; 12 struct ThreadContext;
@@ -74,6 +75,20 @@ public:
74 virtual void SetCPSR(u32 cpsr) = 0; 75 virtual void SetCPSR(u32 cpsr) = 0;
75 76
76 /** 77 /**
78 * Gets the value stored in a CP15 register.
79 * @param reg The CP15 register to retrieve the value from.
80 * @return the value stored in the given CP15 register.
81 */
82 virtual u32 GetCP15Register(CP15Register reg) = 0;
83
84 /**
85 * Stores the given value into the indicated CP15 register.
86 * @param reg The CP15 register to store the value into.
87 * @param value The value to store into the CP15 register.
88 */
89 virtual void SetCP15Register(CP15Register reg, u32 value) = 0;
90
91 /**
77 * Advance the CPU core by the specified number of ticks (e.g. to simulate CPU execution time) 92 * Advance the CPU core by the specified number of ticks (e.g. to simulate CPU execution time)
78 * @param ticks Number of ticks to advance the CPU core 93 * @param ticks Number of ticks to advance the CPU core
79 */ 94 */
diff --git a/src/core/arm/dyncom/arm_dyncom.cpp b/src/core/arm/dyncom/arm_dyncom.cpp
index cb1a410a0..1b1d01420 100644
--- a/src/core/arm/dyncom/arm_dyncom.cpp
+++ b/src/core/arm/dyncom/arm_dyncom.cpp
@@ -68,6 +68,14 @@ void ARM_DynCom::SetCPSR(u32 cpsr) {
68 state->Cpsr = cpsr; 68 state->Cpsr = cpsr;
69} 69}
70 70
71u32 ARM_DynCom::GetCP15Register(CP15Register reg) {
72 return state->CP15[reg];
73}
74
75void ARM_DynCom::SetCP15Register(CP15Register reg, u32 value) {
76 state->CP15[reg] = value;
77}
78
71void ARM_DynCom::AddTicks(u64 ticks) { 79void ARM_DynCom::AddTicks(u64 ticks) {
72 down_count -= ticks; 80 down_count -= ticks;
73 if (down_count < 0) 81 if (down_count < 0)
diff --git a/src/core/arm/dyncom/arm_dyncom.h b/src/core/arm/dyncom/arm_dyncom.h
index a7f95d307..822b3bbb9 100644
--- a/src/core/arm/dyncom/arm_dyncom.h
+++ b/src/core/arm/dyncom/arm_dyncom.h
@@ -22,6 +22,8 @@ public:
22 void SetReg(int index, u32 value) override; 22 void SetReg(int index, u32 value) override;
23 u32 GetCPSR() const override; 23 u32 GetCPSR() const override;
24 void SetCPSR(u32 cpsr) override; 24 void SetCPSR(u32 cpsr) override;
25 u32 GetCP15Register(CP15Register reg) override;
26 void SetCP15Register(CP15Register reg, u32 value) override;
25 27
26 void AddTicks(u64 ticks) override; 28 void AddTicks(u64 ticks) override;
27 29
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
index 8b1232c6c..65fe8a055 100644
--- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
+++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
@@ -3700,7 +3700,6 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
3700 #define OPCODE_1 inst_cream->opcode_1 3700 #define OPCODE_1 inst_cream->opcode_1
3701 #define OPCODE_2 inst_cream->opcode_2 3701 #define OPCODE_2 inst_cream->opcode_2
3702 #define CRm inst_cream->crm 3702 #define CRm inst_cream->crm
3703 #define CP15_REG(n) cpu->CP15[CP15(n)]
3704 #define RD cpu->Reg[inst_cream->Rd] 3703 #define RD cpu->Reg[inst_cream->Rd]
3705 #define RD2 cpu->Reg[inst_cream->Rd + 1] 3704 #define RD2 cpu->Reg[inst_cream->Rd + 1]
3706 #define RN cpu->Reg[inst_cream->Rn] 3705 #define RN cpu->Reg[inst_cream->Rn]
diff --git a/src/core/arm/interpreter/arminit.cpp b/src/core/arm/interpreter/arminit.cpp
index 4ac827e0a..1d732fe84 100644
--- a/src/core/arm/interpreter/arminit.cpp
+++ b/src/core/arm/interpreter/arminit.cpp
@@ -16,6 +16,7 @@
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17 17
18#include <cstring> 18#include <cstring>
19#include "core/mem_map.h"
19#include "core/arm/skyeye_common/armdefs.h" 20#include "core/arm/skyeye_common/armdefs.h"
20#include "core/arm/skyeye_common/armemu.h" 21#include "core/arm/skyeye_common/armemu.h"
21 22
@@ -66,6 +67,64 @@ void ARMul_SelectProcessor(ARMul_State* state, unsigned properties)
66 ARMul_CoProInit(state); 67 ARMul_CoProInit(state);
67} 68}
68 69
70// Resets certain MPCore CP15 values to their ARM-defined reset values.
71static void ResetMPCoreCP15Registers(ARMul_State* cpu)
72{
73 // c0
74 cpu->CP15[CP15_MAIN_ID] = 0x410FB024;
75 cpu->CP15[CP15_TLB_TYPE] = 0x00000800;
76 cpu->CP15[CP15_PROCESSOR_FEATURE_0] = 0x00000111;
77 cpu->CP15[CP15_PROCESSOR_FEATURE_1] = 0x00000001;
78 cpu->CP15[CP15_DEBUG_FEATURE_0] = 0x00000002;
79 cpu->CP15[CP15_MEMORY_MODEL_FEATURE_0] = 0x01100103;
80 cpu->CP15[CP15_MEMORY_MODEL_FEATURE_1] = 0x10020302;
81 cpu->CP15[CP15_MEMORY_MODEL_FEATURE_2] = 0x01222000;
82 cpu->CP15[CP15_MEMORY_MODEL_FEATURE_3] = 0x00000000;
83 cpu->CP15[CP15_ISA_FEATURE_0] = 0x00100011;
84 cpu->CP15[CP15_ISA_FEATURE_1] = 0x12002111;
85 cpu->CP15[CP15_ISA_FEATURE_2] = 0x11221011;
86 cpu->CP15[CP15_ISA_FEATURE_3] = 0x01102131;
87 cpu->CP15[CP15_ISA_FEATURE_4] = 0x00000141;
88
89 // c1
90 cpu->CP15[CP15_CONTROL] = 0x00054078;
91 cpu->CP15[CP15_AUXILIARY_CONTROL] = 0x0000000F;
92 cpu->CP15[CP15_COPROCESSOR_ACCESS_CONTROL] = 0x00000000;
93
94 // c2
95 cpu->CP15[CP15_TRANSLATION_BASE_TABLE_0] = 0x00000000;
96 cpu->CP15[CP15_TRANSLATION_BASE_TABLE_1] = 0x00000000;
97 cpu->CP15[CP15_TRANSLATION_BASE_CONTROL] = 0x00000000;
98
99 // c3
100 cpu->CP15[CP15_DOMAIN_ACCESS_CONTROL] = 0x00000000;
101
102 // c7
103 cpu->CP15[CP15_PHYS_ADDRESS] = 0x00000000;
104
105 // c9
106 cpu->CP15[CP15_DATA_CACHE_LOCKDOWN] = 0xFFFFFFF0;
107
108 // c10
109 cpu->CP15[CP15_TLB_LOCKDOWN] = 0x00000000;
110 cpu->CP15[CP15_PRIMARY_REGION_REMAP] = 0x00098AA4;
111 cpu->CP15[CP15_NORMAL_REGION_REMAP] = 0x44E048E0;
112
113 // c13
114 cpu->CP15[CP15_PID] = 0x00000000;
115 cpu->CP15[CP15_CONTEXT_ID] = 0x00000000;
116 cpu->CP15[CP15_THREAD_UPRW] = 0x00000000;
117 cpu->CP15[CP15_THREAD_URO] = 0x00000000;
118 cpu->CP15[CP15_THREAD_PRW] = 0x00000000;
119
120 // c15
121 cpu->CP15[CP15_PERFORMANCE_MONITOR_CONTROL] = 0x00000000;
122 cpu->CP15[CP15_MAIN_TLB_LOCKDOWN_VIRT_ADDRESS] = 0x00000000;
123 cpu->CP15[CP15_MAIN_TLB_LOCKDOWN_PHYS_ADDRESS] = 0x00000000;
124 cpu->CP15[CP15_MAIN_TLB_LOCKDOWN_ATTRIBUTE] = 0x00000000;
125 cpu->CP15[CP15_TLB_DEBUG_CONTROL] = 0x00000000;
126}
127
69/***************************************************************************\ 128/***************************************************************************\
70* Call this routine to set up the initial machine state (or perform a RESET * 129* Call this routine to set up the initial machine state (or perform a RESET *
71\***************************************************************************/ 130\***************************************************************************/
@@ -80,6 +139,8 @@ void ARMul_Reset(ARMul_State* state)
80 state->Bank = SVCBANK; 139 state->Bank = SVCBANK;
81 FLUSHPIPE; 140 FLUSHPIPE;
82 141
142 ResetMPCoreCP15Registers(state);
143
83 state->EndCondition = 0; 144 state->EndCondition = 0;
84 state->ErrorCode = 0; 145 state->ErrorCode = 0;
85 146
diff --git a/src/core/arm/interpreter/armsupp.cpp b/src/core/arm/interpreter/armsupp.cpp
index 6a11a5804..a68d53695 100644
--- a/src/core/arm/interpreter/armsupp.cpp
+++ b/src/core/arm/interpreter/armsupp.cpp
@@ -225,13 +225,10 @@ u32 ReadCP15Register(ARMul_State* cpu, u32 crn, u32 opcode_1, u32 crm, u32 opcod
225 if (crn == 13 && opcode_1 == 0 && crm == 0) 225 if (crn == 13 && opcode_1 == 0 && crm == 0)
226 { 226 {
227 if (opcode_2 == 2) 227 if (opcode_2 == 2)
228 return cpu->CP15[CP15(CP15_THREAD_UPRW)]; 228 return cpu->CP15[CP15_THREAD_UPRW];
229 229
230 // TODO: Whenever TLS is implemented, this should return
231 // "cpu->CP15[CP15(CP15_THREAD_URO)];"
232 // which contains the address of the 0x200-byte TLS
233 if (opcode_2 == 3) 230 if (opcode_2 == 3)
234 return Memory::KERNEL_MEMORY_VADDR; 231 return cpu->CP15[CP15_THREAD_URO];
235 } 232 }
236 233
237 if (InAPrivilegedMode(cpu)) 234 if (InAPrivilegedMode(cpu))
@@ -241,135 +238,135 @@ u32 ReadCP15Register(ARMul_State* cpu, u32 crn, u32 opcode_1, u32 crm, u32 opcod
241 if (crm == 0) 238 if (crm == 0)
242 { 239 {
243 if (opcode_2 == 0) 240 if (opcode_2 == 0)
244 return cpu->CP15[CP15(CP15_MAIN_ID)]; 241 return cpu->CP15[CP15_MAIN_ID];
245 242
246 if (opcode_2 == 1) 243 if (opcode_2 == 1)
247 return cpu->CP15[CP15(CP15_CACHE_TYPE)]; 244 return cpu->CP15[CP15_CACHE_TYPE];
248 245
249 if (opcode_2 == 3) 246 if (opcode_2 == 3)
250 return cpu->CP15[CP15(CP15_TLB_TYPE)]; 247 return cpu->CP15[CP15_TLB_TYPE];
251 248
252 if (opcode_2 == 5) 249 if (opcode_2 == 5)
253 return cpu->CP15[CP15(CP15_CPU_ID)]; 250 return cpu->CP15[CP15_CPU_ID];
254 } 251 }
255 else if (crm == 1) 252 else if (crm == 1)
256 { 253 {
257 if (opcode_2 == 0) 254 if (opcode_2 == 0)
258 return cpu->CP15[CP15(CP15_PROCESSOR_FEATURE_0)]; 255 return cpu->CP15[CP15_PROCESSOR_FEATURE_0];
259 256
260 if (opcode_2 == 1) 257 if (opcode_2 == 1)
261 return cpu->CP15[CP15(CP15_PROCESSOR_FEATURE_1)]; 258 return cpu->CP15[CP15_PROCESSOR_FEATURE_1];
262 259
263 if (opcode_2 == 2) 260 if (opcode_2 == 2)
264 return cpu->CP15[CP15(CP15_DEBUG_FEATURE_0)]; 261 return cpu->CP15[CP15_DEBUG_FEATURE_0];
265 262
266 if (opcode_2 == 4) 263 if (opcode_2 == 4)
267 return cpu->CP15[CP15(CP15_MEMORY_MODEL_FEATURE_0)]; 264 return cpu->CP15[CP15_MEMORY_MODEL_FEATURE_0];
268 265
269 if (opcode_2 == 5) 266 if (opcode_2 == 5)
270 return cpu->CP15[CP15(CP15_MEMORY_MODEL_FEATURE_1)]; 267 return cpu->CP15[CP15_MEMORY_MODEL_FEATURE_1];
271 268
272 if (opcode_2 == 6) 269 if (opcode_2 == 6)
273 return cpu->CP15[CP15(CP15_MEMORY_MODEL_FEATURE_2)]; 270 return cpu->CP15[CP15_MEMORY_MODEL_FEATURE_2];
274 271
275 if (opcode_2 == 7) 272 if (opcode_2 == 7)
276 return cpu->CP15[CP15(CP15_MEMORY_MODEL_FEATURE_3)]; 273 return cpu->CP15[CP15_MEMORY_MODEL_FEATURE_3];
277 } 274 }
278 else if (crm == 2) 275 else if (crm == 2)
279 { 276 {
280 if (opcode_2 == 0) 277 if (opcode_2 == 0)
281 return cpu->CP15[CP15(CP15_ISA_FEATURE_0)]; 278 return cpu->CP15[CP15_ISA_FEATURE_0];
282 279
283 if (opcode_2 == 1) 280 if (opcode_2 == 1)
284 return cpu->CP15[CP15(CP15_ISA_FEATURE_1)]; 281 return cpu->CP15[CP15_ISA_FEATURE_1];
285 282
286 if (opcode_2 == 2) 283 if (opcode_2 == 2)
287 return cpu->CP15[CP15(CP15_ISA_FEATURE_2)]; 284 return cpu->CP15[CP15_ISA_FEATURE_2];
288 285
289 if (opcode_2 == 3) 286 if (opcode_2 == 3)
290 return cpu->CP15[CP15(CP15_ISA_FEATURE_3)]; 287 return cpu->CP15[CP15_ISA_FEATURE_3];
291 288
292 if (opcode_2 == 4) 289 if (opcode_2 == 4)
293 return cpu->CP15[CP15(CP15_ISA_FEATURE_4)]; 290 return cpu->CP15[CP15_ISA_FEATURE_4];
294 } 291 }
295 } 292 }
296 293
297 if (crn == 1 && opcode_1 == 0 && crm == 0) 294 if (crn == 1 && opcode_1 == 0 && crm == 0)
298 { 295 {
299 if (opcode_2 == 0) 296 if (opcode_2 == 0)
300 return cpu->CP15[CP15(CP15_CONTROL)]; 297 return cpu->CP15[CP15_CONTROL];
301 298
302 if (opcode_2 == 1) 299 if (opcode_2 == 1)
303 return cpu->CP15[CP15(CP15_AUXILIARY_CONTROL)]; 300 return cpu->CP15[CP15_AUXILIARY_CONTROL];
304 301
305 if (opcode_2 == 2) 302 if (opcode_2 == 2)
306 return cpu->CP15[CP15(CP15_COPROCESSOR_ACCESS_CONTROL)]; 303 return cpu->CP15[CP15_COPROCESSOR_ACCESS_CONTROL];
307 } 304 }
308 305
309 if (crn == 2 && opcode_1 == 0 && crm == 0) 306 if (crn == 2 && opcode_1 == 0 && crm == 0)
310 { 307 {
311 if (opcode_2 == 0) 308 if (opcode_2 == 0)
312 return cpu->CP15[CP15(CP15_TRANSLATION_BASE_TABLE_0)]; 309 return cpu->CP15[CP15_TRANSLATION_BASE_TABLE_0];
313 310
314 if (opcode_2 == 1) 311 if (opcode_2 == 1)
315 return cpu->CP15[CP15(CP15_TRANSLATION_BASE_TABLE_1)]; 312 return cpu->CP15[CP15_TRANSLATION_BASE_TABLE_1];
316 313
317 if (opcode_2 == 2) 314 if (opcode_2 == 2)
318 return cpu->CP15[CP15(CP15_TRANSLATION_BASE_CONTROL)]; 315 return cpu->CP15[CP15_TRANSLATION_BASE_CONTROL];
319 } 316 }
320 317
321 if (crn == 3 && opcode_1 == 0 && crm == 0 && opcode_2 == 0) 318 if (crn == 3 && opcode_1 == 0 && crm == 0 && opcode_2 == 0)
322 return cpu->CP15[CP15(CP15_DOMAIN_ACCESS_CONTROL)]; 319 return cpu->CP15[CP15_DOMAIN_ACCESS_CONTROL];
323 320
324 if (crn == 5 && opcode_1 == 0 && crm == 0) 321 if (crn == 5 && opcode_1 == 0 && crm == 0)
325 { 322 {
326 if (opcode_2 == 0) 323 if (opcode_2 == 0)
327 return cpu->CP15[CP15(CP15_FAULT_STATUS)]; 324 return cpu->CP15[CP15_FAULT_STATUS];
328 325
329 if (opcode_2 == 1) 326 if (opcode_2 == 1)
330 return cpu->CP15[CP15(CP15_INSTR_FAULT_STATUS)]; 327 return cpu->CP15[CP15_INSTR_FAULT_STATUS];
331 } 328 }
332 329
333 if (crn == 6 && opcode_1 == 0 && crm == 0) 330 if (crn == 6 && opcode_1 == 0 && crm == 0)
334 { 331 {
335 if (opcode_2 == 0) 332 if (opcode_2 == 0)
336 return cpu->CP15[CP15(CP15_FAULT_ADDRESS)]; 333 return cpu->CP15[CP15_FAULT_ADDRESS];
337 334
338 if (opcode_2 == 1) 335 if (opcode_2 == 1)
339 return cpu->CP15[CP15(CP15_WFAR)]; 336 return cpu->CP15[CP15_WFAR];
340 } 337 }
341 338
342 if (crn == 7 && opcode_1 == 0 && crm == 4 && opcode_2 == 0) 339 if (crn == 7 && opcode_1 == 0 && crm == 4 && opcode_2 == 0)
343 return cpu->CP15[CP15(CP15_PHYS_ADDRESS)]; 340 return cpu->CP15[CP15_PHYS_ADDRESS];
344 341
345 if (crn == 9 && opcode_1 == 0 && crm == 0 && opcode_2 == 0) 342 if (crn == 9 && opcode_1 == 0 && crm == 0 && opcode_2 == 0)
346 return cpu->CP15[CP15(CP15_DATA_CACHE_LOCKDOWN)]; 343 return cpu->CP15[CP15_DATA_CACHE_LOCKDOWN];
347 344
348 if (crn == 10 && opcode_1 == 0) 345 if (crn == 10 && opcode_1 == 0)
349 { 346 {
350 if (crm == 0 && opcode_2 == 0) 347 if (crm == 0 && opcode_2 == 0)
351 return cpu->CP15[CP15(CP15_TLB_LOCKDOWN)]; 348 return cpu->CP15[CP15_TLB_LOCKDOWN];
352 349
353 if (crm == 2) 350 if (crm == 2)
354 { 351 {
355 if (opcode_2 == 0) 352 if (opcode_2 == 0)
356 return cpu->CP15[CP15(CP15_PRIMARY_REGION_REMAP)]; 353 return cpu->CP15[CP15_PRIMARY_REGION_REMAP];
357 354
358 if (opcode_2 == 1) 355 if (opcode_2 == 1)
359 return cpu->CP15[CP15(CP15_NORMAL_REGION_REMAP)]; 356 return cpu->CP15[CP15_NORMAL_REGION_REMAP];
360 } 357 }
361 } 358 }
362 359
363 if (crn == 13 && crm == 0) 360 if (crn == 13 && crm == 0)
364 { 361 {
365 if (opcode_2 == 0) 362 if (opcode_2 == 0)
366 return cpu->CP15[CP15(CP15_PID)]; 363 return cpu->CP15[CP15_PID];
367 364
368 if (opcode_2 == 1) 365 if (opcode_2 == 1)
369 return cpu->CP15[CP15(CP15_CONTEXT_ID)]; 366 return cpu->CP15[CP15_CONTEXT_ID];
370 367
371 if (opcode_2 == 4) 368 if (opcode_2 == 4)
372 return cpu->CP15[CP15(CP15_THREAD_PRW)]; 369 return cpu->CP15[CP15_THREAD_PRW];
373 } 370 }
374 371
375 if (crn == 15) 372 if (crn == 15)
@@ -377,32 +374,32 @@ u32 ReadCP15Register(ARMul_State* cpu, u32 crn, u32 opcode_1, u32 crm, u32 opcod
377 if (opcode_1 == 0 && crm == 12) 374 if (opcode_1 == 0 && crm == 12)
378 { 375 {
379 if (opcode_2 == 0) 376 if (opcode_2 == 0)
380 return cpu->CP15[CP15(CP15_PERFORMANCE_MONITOR_CONTROL)]; 377 return cpu->CP15[CP15_PERFORMANCE_MONITOR_CONTROL];
381 378
382 if (opcode_2 == 1) 379 if (opcode_2 == 1)
383 return cpu->CP15[CP15(CP15_CYCLE_COUNTER)]; 380 return cpu->CP15[CP15_CYCLE_COUNTER];
384 381
385 if (opcode_2 == 2) 382 if (opcode_2 == 2)
386 return cpu->CP15[CP15(CP15_COUNT_0)]; 383 return cpu->CP15[CP15_COUNT_0];
387 384
388 if (opcode_2 == 3) 385 if (opcode_2 == 3)
389 return cpu->CP15[CP15(CP15_COUNT_1)]; 386 return cpu->CP15[CP15_COUNT_1];
390 } 387 }
391 388
392 if (opcode_1 == 5 && opcode_2 == 2) 389 if (opcode_1 == 5 && opcode_2 == 2)
393 { 390 {
394 if (crm == 5) 391 if (crm == 5)
395 return cpu->CP15[CP15(CP15_MAIN_TLB_LOCKDOWN_VIRT_ADDRESS)]; 392 return cpu->CP15[CP15_MAIN_TLB_LOCKDOWN_VIRT_ADDRESS];
396 393
397 if (crm == 6) 394 if (crm == 6)
398 return cpu->CP15[CP15(CP15_MAIN_TLB_LOCKDOWN_PHYS_ADDRESS)]; 395 return cpu->CP15[CP15_MAIN_TLB_LOCKDOWN_PHYS_ADDRESS];
399 396
400 if (crm == 7) 397 if (crm == 7)
401 return cpu->CP15[CP15(CP15_MAIN_TLB_LOCKDOWN_ATTRIBUTE)]; 398 return cpu->CP15[CP15_MAIN_TLB_LOCKDOWN_ATTRIBUTE];
402 } 399 }
403 400
404 if (opcode_1 == 7 && crm == 1 && opcode_2 == 0) 401 if (opcode_1 == 7 && crm == 1 && opcode_2 == 0)
405 return cpu->CP15[CP15(CP15_TLB_DEBUG_CONTROL)]; 402 return cpu->CP15[CP15_TLB_DEBUG_CONTROL];
406 } 403 }
407 } 404 }
408 405
@@ -420,38 +417,38 @@ void WriteCP15Register(ARMul_State* cpu, u32 value, u32 crn, u32 opcode_1, u32 c
420 if (crn == 1 && opcode_1 == 0 && crm == 0) 417 if (crn == 1 && opcode_1 == 0 && crm == 0)
421 { 418 {
422 if (opcode_2 == 0) 419 if (opcode_2 == 0)
423 cpu->CP15[CP15(CP15_CONTROL)] = value; 420 cpu->CP15[CP15_CONTROL] = value;
424 else if (opcode_2 == 1) 421 else if (opcode_2 == 1)
425 cpu->CP15[CP15(CP15_AUXILIARY_CONTROL)] = value; 422 cpu->CP15[CP15_AUXILIARY_CONTROL] = value;
426 else if (opcode_2 == 2) 423 else if (opcode_2 == 2)
427 cpu->CP15[CP15(CP15_COPROCESSOR_ACCESS_CONTROL)] = value; 424 cpu->CP15[CP15_COPROCESSOR_ACCESS_CONTROL] = value;
428 } 425 }
429 else if (crn == 2 && opcode_1 == 0 && crm == 0) 426 else if (crn == 2 && opcode_1 == 0 && crm == 0)
430 { 427 {
431 if (opcode_2 == 0) 428 if (opcode_2 == 0)
432 cpu->CP15[CP15(CP15_TRANSLATION_BASE_TABLE_0)] = value; 429 cpu->CP15[CP15_TRANSLATION_BASE_TABLE_0] = value;
433 else if (opcode_2 == 1) 430 else if (opcode_2 == 1)
434 cpu->CP15[CP15(CP15_TRANSLATION_BASE_TABLE_1)] = value; 431 cpu->CP15[CP15_TRANSLATION_BASE_TABLE_1] = value;
435 else if (opcode_2 == 2) 432 else if (opcode_2 == 2)
436 cpu->CP15[CP15(CP15_TRANSLATION_BASE_CONTROL)] = value; 433 cpu->CP15[CP15_TRANSLATION_BASE_CONTROL] = value;
437 } 434 }
438 else if (crn == 3 && opcode_1 == 0 && crm == 0 && opcode_2 == 0) 435 else if (crn == 3 && opcode_1 == 0 && crm == 0 && opcode_2 == 0)
439 { 436 {
440 cpu->CP15[CP15(CP15_DOMAIN_ACCESS_CONTROL)] = value; 437 cpu->CP15[CP15_DOMAIN_ACCESS_CONTROL] = value;
441 } 438 }
442 else if (crn == 5 && opcode_1 == 0 && crm == 0) 439 else if (crn == 5 && opcode_1 == 0 && crm == 0)
443 { 440 {
444 if (opcode_2 == 0) 441 if (opcode_2 == 0)
445 cpu->CP15[CP15(CP15_FAULT_STATUS)] = value; 442 cpu->CP15[CP15_FAULT_STATUS] = value;
446 else if (opcode_2 == 1) 443 else if (opcode_2 == 1)
447 cpu->CP15[CP15(CP15_INSTR_FAULT_STATUS)] = value; 444 cpu->CP15[CP15_INSTR_FAULT_STATUS] = value;
448 } 445 }
449 else if (crn == 6 && opcode_1 == 0 && crm == 0) 446 else if (crn == 6 && opcode_1 == 0 && crm == 0)
450 { 447 {
451 if (opcode_2 == 0) 448 if (opcode_2 == 0)
452 cpu->CP15[CP15(CP15_FAULT_ADDRESS)] = value; 449 cpu->CP15[CP15_FAULT_ADDRESS] = value;
453 else if (opcode_2 == 1) 450 else if (opcode_2 == 1)
454 cpu->CP15[CP15(CP15_WFAR)] = value; 451 cpu->CP15[CP15_WFAR] = value;
455 } 452 }
456 else if (crn == 7 && opcode_1 == 0) 453 else if (crn == 7 && opcode_1 == 0)
457 { 454 {
@@ -459,56 +456,56 @@ void WriteCP15Register(ARMul_State* cpu, u32 value, u32 crn, u32 opcode_1, u32 c
459 456
460 if (crm == 0 && opcode_2 == 4) 457 if (crm == 0 && opcode_2 == 4)
461 { 458 {
462 cpu->CP15[CP15(CP15_WAIT_FOR_INTERRUPT)] = value; 459 cpu->CP15[CP15_WAIT_FOR_INTERRUPT] = value;
463 } 460 }
464 else if (crm == 4 && opcode_2 == 0) 461 else if (crm == 4 && opcode_2 == 0)
465 { 462 {
466 // NOTE: Not entirely accurate. This should do permission checks. 463 // NOTE: Not entirely accurate. This should do permission checks.
467 cpu->CP15[CP15(CP15_PHYS_ADDRESS)] = Memory::VirtualToPhysicalAddress(value); 464 cpu->CP15[CP15_PHYS_ADDRESS] = Memory::VirtualToPhysicalAddress(value);
468 } 465 }
469 else if (crm == 5) 466 else if (crm == 5)
470 { 467 {
471 if (opcode_2 == 0) 468 if (opcode_2 == 0)
472 cpu->CP15[CP15(CP15_INVALIDATE_INSTR_CACHE)] = value; 469 cpu->CP15[CP15_INVALIDATE_INSTR_CACHE] = value;
473 else if (opcode_2 == 1) 470 else if (opcode_2 == 1)
474 cpu->CP15[CP15(CP15_INVALIDATE_INSTR_CACHE_USING_MVA)] = value; 471 cpu->CP15[CP15_INVALIDATE_INSTR_CACHE_USING_MVA] = value;
475 else if (opcode_2 == 2) 472 else if (opcode_2 == 2)
476 cpu->CP15[CP15(CP15_INVALIDATE_INSTR_CACHE_USING_INDEX)] = value; 473 cpu->CP15[CP15_INVALIDATE_INSTR_CACHE_USING_INDEX] = value;
477 else if (opcode_2 == 6) 474 else if (opcode_2 == 6)
478 cpu->CP15[CP15(CP15_FLUSH_BRANCH_TARGET_CACHE)] = value; 475 cpu->CP15[CP15_FLUSH_BRANCH_TARGET_CACHE] = value;
479 else if (opcode_2 == 7) 476 else if (opcode_2 == 7)
480 cpu->CP15[CP15(CP15_FLUSH_BRANCH_TARGET_CACHE_ENTRY)] = value; 477 cpu->CP15[CP15_FLUSH_BRANCH_TARGET_CACHE_ENTRY] = value;
481 } 478 }
482 else if (crm == 6) 479 else if (crm == 6)
483 { 480 {
484 if (opcode_2 == 0) 481 if (opcode_2 == 0)
485 cpu->CP15[CP15(CP15_INVALIDATE_DATA_CACHE)] = value; 482 cpu->CP15[CP15_INVALIDATE_DATA_CACHE] = value;
486 else if (opcode_2 == 1) 483 else if (opcode_2 == 1)
487 cpu->CP15[CP15(CP15_INVALIDATE_DATA_CACHE_LINE_USING_MVA)] = value; 484 cpu->CP15[CP15_INVALIDATE_DATA_CACHE_LINE_USING_MVA] = value;
488 else if (opcode_2 == 2) 485 else if (opcode_2 == 2)
489 cpu->CP15[CP15(CP15_INVALIDATE_DATA_CACHE_LINE_USING_INDEX)] = value; 486 cpu->CP15[CP15_INVALIDATE_DATA_CACHE_LINE_USING_INDEX] = value;
490 } 487 }
491 else if (crm == 7 && opcode_2 == 0) 488 else if (crm == 7 && opcode_2 == 0)
492 { 489 {
493 cpu->CP15[CP15(CP15_INVALIDATE_DATA_AND_INSTR_CACHE)] = value; 490 cpu->CP15[CP15_INVALIDATE_DATA_AND_INSTR_CACHE] = value;
494 } 491 }
495 else if (crm == 10) 492 else if (crm == 10)
496 { 493 {
497 if (opcode_2 == 0) 494 if (opcode_2 == 0)
498 cpu->CP15[CP15(CP15_CLEAN_DATA_CACHE)] = value; 495 cpu->CP15[CP15_CLEAN_DATA_CACHE] = value;
499 else if (opcode_2 == 1) 496 else if (opcode_2 == 1)
500 cpu->CP15[CP15(CP15_CLEAN_DATA_CACHE_LINE_USING_MVA)] = value; 497 cpu->CP15[CP15_CLEAN_DATA_CACHE_LINE_USING_MVA] = value;
501 else if (opcode_2 == 2) 498 else if (opcode_2 == 2)
502 cpu->CP15[CP15(CP15_CLEAN_DATA_CACHE_LINE_USING_INDEX)] = value; 499 cpu->CP15[CP15_CLEAN_DATA_CACHE_LINE_USING_INDEX] = value;
503 } 500 }
504 else if (crm == 14) 501 else if (crm == 14)
505 { 502 {
506 if (opcode_2 == 0) 503 if (opcode_2 == 0)
507 cpu->CP15[CP15(CP15_CLEAN_AND_INVALIDATE_DATA_CACHE)] = value; 504 cpu->CP15[CP15_CLEAN_AND_INVALIDATE_DATA_CACHE] = value;
508 else if (opcode_2 == 1) 505 else if (opcode_2 == 1)
509 cpu->CP15[CP15(CP15_CLEAN_AND_INVALIDATE_DATA_CACHE_LINE_USING_MVA)] = value; 506 cpu->CP15[CP15_CLEAN_AND_INVALIDATE_DATA_CACHE_LINE_USING_MVA] = value;
510 else if (opcode_2 == 2) 507 else if (opcode_2 == 2)
511 cpu->CP15[CP15(CP15_CLEAN_AND_INVALIDATE_DATA_CACHE_LINE_USING_INDEX)] = value; 508 cpu->CP15[CP15_CLEAN_AND_INVALIDATE_DATA_CACHE_LINE_USING_INDEX] = value;
512 } 509 }
513 } 510 }
514 else if (crn == 8 && opcode_1 == 0) 511 else if (crn == 8 && opcode_1 == 0)
@@ -518,104 +515,104 @@ void WriteCP15Register(ARMul_State* cpu, u32 value, u32 crn, u32 opcode_1, u32 c
518 if (crm == 5) 515 if (crm == 5)
519 { 516 {
520 if (opcode_2 == 0) 517 if (opcode_2 == 0)
521 cpu->CP15[CP15(CP15_INVALIDATE_ITLB)] = value; 518 cpu->CP15[CP15_INVALIDATE_ITLB] = value;
522 else if (opcode_2 == 1) 519 else if (opcode_2 == 1)
523 cpu->CP15[CP15(CP15_INVALIDATE_ITLB_SINGLE_ENTRY)] = value; 520 cpu->CP15[CP15_INVALIDATE_ITLB_SINGLE_ENTRY] = value;
524 else if (opcode_2 == 2) 521 else if (opcode_2 == 2)
525 cpu->CP15[CP15(CP15_INVALIDATE_ITLB_ENTRY_ON_ASID_MATCH)] = value; 522 cpu->CP15[CP15_INVALIDATE_ITLB_ENTRY_ON_ASID_MATCH] = value;
526 else if (opcode_2 == 3) 523 else if (opcode_2 == 3)
527 cpu->CP15[CP15(CP15_INVALIDATE_ITLB_ENTRY_ON_MVA)] = value; 524 cpu->CP15[CP15_INVALIDATE_ITLB_ENTRY_ON_MVA] = value;
528 } 525 }
529 else if (crm == 6) 526 else if (crm == 6)
530 { 527 {
531 if (opcode_2 == 0) 528 if (opcode_2 == 0)
532 cpu->CP15[CP15(CP15_INVALIDATE_DTLB)] = value; 529 cpu->CP15[CP15_INVALIDATE_DTLB] = value;
533 else if (opcode_2 == 1) 530 else if (opcode_2 == 1)
534 cpu->CP15[CP15(CP15_INVALIDATE_DTLB_SINGLE_ENTRY)] = value; 531 cpu->CP15[CP15_INVALIDATE_DTLB_SINGLE_ENTRY] = value;
535 else if (opcode_2 == 2) 532 else if (opcode_2 == 2)
536 cpu->CP15[CP15(CP15_INVALIDATE_DTLB_ENTRY_ON_ASID_MATCH)] = value; 533 cpu->CP15[CP15_INVALIDATE_DTLB_ENTRY_ON_ASID_MATCH] = value;
537 else if (opcode_2 == 3) 534 else if (opcode_2 == 3)
538 cpu->CP15[CP15(CP15_INVALIDATE_DTLB_ENTRY_ON_MVA)] = value; 535 cpu->CP15[CP15_INVALIDATE_DTLB_ENTRY_ON_MVA] = value;
539 } 536 }
540 else if (crm == 7) 537 else if (crm == 7)
541 { 538 {
542 if (opcode_2 == 0) 539 if (opcode_2 == 0)
543 cpu->CP15[CP15(CP15_INVALIDATE_UTLB)] = value; 540 cpu->CP15[CP15_INVALIDATE_UTLB] = value;
544 else if (opcode_2 == 1) 541 else if (opcode_2 == 1)
545 cpu->CP15[CP15(CP15_INVALIDATE_UTLB_SINGLE_ENTRY)] = value; 542 cpu->CP15[CP15_INVALIDATE_UTLB_SINGLE_ENTRY] = value;
546 else if (opcode_2 == 2) 543 else if (opcode_2 == 2)
547 cpu->CP15[CP15(CP15_INVALIDATE_UTLB_ENTRY_ON_ASID_MATCH)] = value; 544 cpu->CP15[CP15_INVALIDATE_UTLB_ENTRY_ON_ASID_MATCH] = value;
548 else if (opcode_2 == 3) 545 else if (opcode_2 == 3)
549 cpu->CP15[CP15(CP15_INVALIDATE_UTLB_ENTRY_ON_MVA)] = value; 546 cpu->CP15[CP15_INVALIDATE_UTLB_ENTRY_ON_MVA] = value;
550 } 547 }
551 } 548 }
552 else if (crn == 9 && opcode_1 == 0 && crm == 0 && opcode_2 == 0) 549 else if (crn == 9 && opcode_1 == 0 && crm == 0 && opcode_2 == 0)
553 { 550 {
554 cpu->CP15[CP15(CP15_DATA_CACHE_LOCKDOWN)] = value; 551 cpu->CP15[CP15_DATA_CACHE_LOCKDOWN] = value;
555 } 552 }
556 else if (crn == 10 && opcode_1 == 0) 553 else if (crn == 10 && opcode_1 == 0)
557 { 554 {
558 if (crm == 0 && opcode_2 == 0) 555 if (crm == 0 && opcode_2 == 0)
559 { 556 {
560 cpu->CP15[CP15(CP15_TLB_LOCKDOWN)] = value; 557 cpu->CP15[CP15_TLB_LOCKDOWN] = value;
561 } 558 }
562 else if (crm == 2) 559 else if (crm == 2)
563 { 560 {
564 if (opcode_2 == 0) 561 if (opcode_2 == 0)
565 cpu->CP15[CP15(CP15_PRIMARY_REGION_REMAP)] = value; 562 cpu->CP15[CP15_PRIMARY_REGION_REMAP] = value;
566 else if (opcode_2 == 1) 563 else if (opcode_2 == 1)
567 cpu->CP15[CP15(CP15_NORMAL_REGION_REMAP)] = value; 564 cpu->CP15[CP15_NORMAL_REGION_REMAP] = value;
568 } 565 }
569 } 566 }
570 else if (crn == 13 && opcode_1 == 0 && crm == 0) 567 else if (crn == 13 && opcode_1 == 0 && crm == 0)
571 { 568 {
572 if (opcode_2 == 0) 569 if (opcode_2 == 0)
573 cpu->CP15[CP15(CP15_PID)] = value; 570 cpu->CP15[CP15_PID] = value;
574 else if (opcode_2 == 1) 571 else if (opcode_2 == 1)
575 cpu->CP15[CP15(CP15_CONTEXT_ID)] = value; 572 cpu->CP15[CP15_CONTEXT_ID] = value;
576 else if (opcode_2 == 3) 573 else if (opcode_2 == 3)
577 cpu->CP15[CP15(CP15_THREAD_URO)] = value; 574 cpu->CP15[CP15_THREAD_URO] = value;
578 else if (opcode_2 == 4) 575 else if (opcode_2 == 4)
579 cpu->CP15[CP15(CP15_THREAD_PRW)] = value; 576 cpu->CP15[CP15_THREAD_PRW] = value;
580 } 577 }
581 else if (crn == 15) 578 else if (crn == 15)
582 { 579 {
583 if (opcode_1 == 0 && crm == 12) 580 if (opcode_1 == 0 && crm == 12)
584 { 581 {
585 if (opcode_2 == 0) 582 if (opcode_2 == 0)
586 cpu->CP15[CP15(CP15_PERFORMANCE_MONITOR_CONTROL)] = value; 583 cpu->CP15[CP15_PERFORMANCE_MONITOR_CONTROL] = value;
587 else if (opcode_2 == 1) 584 else if (opcode_2 == 1)
588 cpu->CP15[CP15(CP15_CYCLE_COUNTER)] = value; 585 cpu->CP15[CP15_CYCLE_COUNTER] = value;
589 else if (opcode_2 == 2) 586 else if (opcode_2 == 2)
590 cpu->CP15[CP15(CP15_COUNT_0)] = value; 587 cpu->CP15[CP15_COUNT_0] = value;
591 else if (opcode_2 == 3) 588 else if (opcode_2 == 3)
592 cpu->CP15[CP15(CP15_COUNT_1)] = value; 589 cpu->CP15[CP15_COUNT_1] = value;
593 } 590 }
594 else if (opcode_1 == 5) 591 else if (opcode_1 == 5)
595 { 592 {
596 if (crm == 4) 593 if (crm == 4)
597 { 594 {
598 if (opcode_2 == 2) 595 if (opcode_2 == 2)
599 cpu->CP15[CP15(CP15_READ_MAIN_TLB_LOCKDOWN_ENTRY)] = value; 596 cpu->CP15[CP15_READ_MAIN_TLB_LOCKDOWN_ENTRY] = value;
600 else if (opcode_2 == 4) 597 else if (opcode_2 == 4)
601 cpu->CP15[CP15(CP15_WRITE_MAIN_TLB_LOCKDOWN_ENTRY)] = value; 598 cpu->CP15[CP15_WRITE_MAIN_TLB_LOCKDOWN_ENTRY] = value;
602 } 599 }
603 else if (crm == 5 && opcode_2 == 2) 600 else if (crm == 5 && opcode_2 == 2)
604 { 601 {
605 cpu->CP15[CP15(CP15_MAIN_TLB_LOCKDOWN_VIRT_ADDRESS)] = value; 602 cpu->CP15[CP15_MAIN_TLB_LOCKDOWN_VIRT_ADDRESS] = value;
606 } 603 }
607 else if (crm == 6 && opcode_2 == 2) 604 else if (crm == 6 && opcode_2 == 2)
608 { 605 {
609 cpu->CP15[CP15(CP15_MAIN_TLB_LOCKDOWN_PHYS_ADDRESS)] = value; 606 cpu->CP15[CP15_MAIN_TLB_LOCKDOWN_PHYS_ADDRESS] = value;
610 } 607 }
611 else if (crm == 7 && opcode_2 == 2) 608 else if (crm == 7 && opcode_2 == 2)
612 { 609 {
613 cpu->CP15[CP15(CP15_MAIN_TLB_LOCKDOWN_ATTRIBUTE)] = value; 610 cpu->CP15[CP15_MAIN_TLB_LOCKDOWN_ATTRIBUTE] = value;
614 } 611 }
615 } 612 }
616 else if (opcode_1 == 7 && crm == 1 && opcode_2 == 0) 613 else if (opcode_1 == 7 && crm == 1 && opcode_2 == 0)
617 { 614 {
618 cpu->CP15[CP15(CP15_TLB_DEBUG_CONTROL)] = value; 615 cpu->CP15[CP15_TLB_DEBUG_CONTROL] = value;
619 } 616 }
620 } 617 }
621 } 618 }
@@ -623,18 +620,18 @@ void WriteCP15Register(ARMul_State* cpu, u32 value, u32 crn, u32 opcode_1, u32 c
623 // Unprivileged registers 620 // Unprivileged registers
624 if (crn == 7 && opcode_1 == 0 && crm == 5 && opcode_2 == 4) 621 if (crn == 7 && opcode_1 == 0 && crm == 5 && opcode_2 == 4)
625 { 622 {
626 cpu->CP15[CP15(CP15_FLUSH_PREFETCH_BUFFER)] = value; 623 cpu->CP15[CP15_FLUSH_PREFETCH_BUFFER] = value;
627 } 624 }
628 else if (crn == 7 && opcode_1 == 0 && crm == 10) 625 else if (crn == 7 && opcode_1 == 0 && crm == 10)
629 { 626 {
630 if (opcode_2 == 4) 627 if (opcode_2 == 4)
631 cpu->CP15[CP15(CP15_DATA_SYNC_BARRIER)] = value; 628 cpu->CP15[CP15_DATA_SYNC_BARRIER] = value;
632 else if (opcode_2 == 5) 629 else if (opcode_2 == 5)
633 cpu->CP15[CP15(CP15_DATA_MEMORY_BARRIER)] = value; 630 cpu->CP15[CP15_DATA_MEMORY_BARRIER] = value;
634 631
635 } 632 }
636 else if (crn == 13 && opcode_1 == 0 && crm == 0 && opcode_2 == 2) 633 else if (crn == 13 && opcode_1 == 0 && crm == 0 && opcode_2 == 2)
637 { 634 {
638 cpu->CP15[CP15(CP15_THREAD_UPRW)] = value; 635 cpu->CP15[CP15_THREAD_UPRW] = value;
639 } 636 }
640} 637}
diff --git a/src/core/arm/skyeye_common/arm_regformat.h b/src/core/arm/skyeye_common/arm_regformat.h
index c232376e0..d125dc2fc 100644
--- a/src/core/arm/skyeye_common/arm_regformat.h
+++ b/src/core/arm/skyeye_common/arm_regformat.h
@@ -51,17 +51,23 @@ enum {
51 EXCLUSIVE_STATE, 51 EXCLUSIVE_STATE,
52 EXCLUSIVE_RESULT, 52 EXCLUSIVE_RESULT,
53 53
54 // VFP registers
55 VFP_BASE,
56 VFP_FPSID = VFP_BASE,
57 VFP_FPSCR,
58 VFP_FPEXC,
59
60 MAX_REG_NUM,
61};
62
63enum CP15Register {
54 // c0 - Information registers 64 // c0 - Information registers
55 CP15_BASE, 65 CP15_MAIN_ID,
56 CP15_C0 = CP15_BASE,
57 CP15_C0_C0 = CP15_C0,
58 CP15_MAIN_ID = CP15_C0_C0,
59 CP15_CACHE_TYPE, 66 CP15_CACHE_TYPE,
60 CP15_TCM_STATUS, 67 CP15_TCM_STATUS,
61 CP15_TLB_TYPE, 68 CP15_TLB_TYPE,
62 CP15_CPU_ID, 69 CP15_CPU_ID,
63 CP15_C0_C1, 70 CP15_PROCESSOR_FEATURE_0,
64 CP15_PROCESSOR_FEATURE_0 = CP15_C0_C1,
65 CP15_PROCESSOR_FEATURE_1, 71 CP15_PROCESSOR_FEATURE_1,
66 CP15_DEBUG_FEATURE_0, 72 CP15_DEBUG_FEATURE_0,
67 CP15_AUXILIARY_FEATURE_0, 73 CP15_AUXILIARY_FEATURE_0,
@@ -69,24 +75,19 @@ enum {
69 CP15_MEMORY_MODEL_FEATURE_1, 75 CP15_MEMORY_MODEL_FEATURE_1,
70 CP15_MEMORY_MODEL_FEATURE_2, 76 CP15_MEMORY_MODEL_FEATURE_2,
71 CP15_MEMORY_MODEL_FEATURE_3, 77 CP15_MEMORY_MODEL_FEATURE_3,
72 CP15_C0_C2, 78 CP15_ISA_FEATURE_0,
73 CP15_ISA_FEATURE_0 = CP15_C0_C2,
74 CP15_ISA_FEATURE_1, 79 CP15_ISA_FEATURE_1,
75 CP15_ISA_FEATURE_2, 80 CP15_ISA_FEATURE_2,
76 CP15_ISA_FEATURE_3, 81 CP15_ISA_FEATURE_3,
77 CP15_ISA_FEATURE_4, 82 CP15_ISA_FEATURE_4,
78 83
79 // c1 - Control registers 84 // c1 - Control registers
80 CP15_C1_C0, 85 CP15_CONTROL,
81 CP15_CONTROL = CP15_C1_C0,
82 CP15_AUXILIARY_CONTROL, 86 CP15_AUXILIARY_CONTROL,
83 CP15_COPROCESSOR_ACCESS_CONTROL, 87 CP15_COPROCESSOR_ACCESS_CONTROL,
84 88
85 // c2 - Translation table registers 89 // c2 - Translation table registers
86 CP15_C2, 90 CP15_TRANSLATION_BASE_TABLE_0,
87 CP15_C2_C0 = CP15_C2,
88 CP15_TRANSLATION_BASE = CP15_C2_C0,
89 CP15_TRANSLATION_BASE_TABLE_0 = CP15_TRANSLATION_BASE,
90 CP15_TRANSLATION_BASE_TABLE_1, 91 CP15_TRANSLATION_BASE_TABLE_1,
91 CP15_TRANSLATION_BASE_CONTROL, 92 CP15_TRANSLATION_BASE_CONTROL,
92 CP15_DOMAIN_ACCESS_CONTROL, 93 CP15_DOMAIN_ACCESS_CONTROL,
@@ -171,14 +172,9 @@ enum {
171 CP15_TLB_FAULT_ADDR, 172 CP15_TLB_FAULT_ADDR,
172 CP15_TLB_FAULT_STATUS, 173 CP15_TLB_FAULT_STATUS,
173 174
174 // VFP registers 175 // Not an actual register.
175 VFP_BASE, 176 // All registers should be defined above this.
176 VFP_FPSID = VFP_BASE, 177 CP15_REGISTER_COUNT,
177 VFP_FPSCR,
178 VFP_FPEXC,
179
180 MAX_REG_NUM,
181}; 178};
182 179
183#define CP15(idx) (idx - CP15_BASE)
184#define VFP_OFFSET(x) (x - VFP_BASE) 180#define VFP_OFFSET(x) (x - VFP_BASE)
diff --git a/src/core/arm/skyeye_common/armdefs.h b/src/core/arm/skyeye_common/armdefs.h
index d5b0242c3..12fa533f7 100644
--- a/src/core/arm/skyeye_common/armdefs.h
+++ b/src/core/arm/skyeye_common/armdefs.h
@@ -91,7 +91,7 @@ struct ARMul_State
91 ARMword exclusive_tag; // The address for which the local monitor is in exclusive access mode 91 ARMword exclusive_tag; // The address for which the local monitor is in exclusive access mode
92 ARMword exclusive_state; 92 ARMword exclusive_state;
93 ARMword exclusive_result; 93 ARMword exclusive_result;
94 ARMword CP15[VFP_BASE - CP15_BASE]; 94 ARMword CP15[CP15_REGISTER_COUNT];
95 ARMword VFP[3]; // FPSID, FPSCR, and FPEXC 95 ARMword VFP[3]; // FPSID, FPSCR, and FPEXC
96 // VFPv2 and VFPv3-D16 has 16 doubleword registers (D0-D16 or S0-S31). 96 // VFPv2 and VFPv3-D16 has 16 doubleword registers (D0-D16 or S0-S31).
97 // VFPv3-D32/ASIMD may have up to 32 doubleword registers (D0-D31), 97 // VFPv3-D32/ASIMD may have up to 32 doubleword registers (D0-D31),
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 15787bc17..81e642318 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -7,6 +7,7 @@
7#include "core/core.h" 7#include "core/core.h"
8#include "core/core_timing.h" 8#include "core/core_timing.h"
9 9
10#include "core/mem_map.h"
10#include "core/settings.h" 11#include "core/settings.h"
11#include "core/arm/arm_interface.h" 12#include "core/arm/arm_interface.h"
12#include "core/arm/disassembler/arm_disasm.h" 13#include "core/arm/disassembler/arm_disasm.h"
@@ -59,6 +60,10 @@ int Init() {
59 g_sys_core = new ARM_DynCom(USER32MODE); 60 g_sys_core = new ARM_DynCom(USER32MODE);
60 g_app_core = new ARM_DynCom(USER32MODE); 61 g_app_core = new ARM_DynCom(USER32MODE);
61 62
63 // TODO: Whenever TLS is implemented, this should contain
64 // the address of the 0x200-byte TLS
65 g_app_core->SetCP15Register(CP15_THREAD_URO, Memory::KERNEL_MEMORY_VADDR);
66
62 LOG_DEBUG(Core, "Initialized OK"); 67 LOG_DEBUG(Core, "Initialized OK");
63 return 0; 68 return 0;
64} 69}