aboutsummaryrefslogtreecommitdiff
path: root/src/ARM.cpp
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2021-10-28 21:15:12 +0200
committerArisotura <thetotalworm@gmail.com>2021-10-28 21:15:12 +0200
commite121953c9a42e853dc71f08e1e342ecd1e2c8753 (patch)
treeba69a2b02d82275eaf38035b5e632f9185d503ec /src/ARM.cpp
parentbfe50e41b42383245790d31d0c12e5f65b3b7dae (diff)
more complete (and accurate) CP15 setup for direct boot
Diffstat (limited to 'src/ARM.cpp')
-rw-r--r--src/ARM.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/ARM.cpp b/src/ARM.cpp
index bdb10bf..1abdbdd 100644
--- a/src/ARM.cpp
+++ b/src/ARM.cpp
@@ -162,6 +162,8 @@ void ARMv5::Reset()
GetMemRegion = NDS::ARM9GetMemRegion;
}
+ //PU_Map = PU_PrivMap;
+
ARM::Reset();
}
@@ -225,10 +227,22 @@ void ARM::DoSavestate(Savestate* file)
if (!file->Saving)
{
+ CPSR |= 0x00000010;
+ R_FIQ[7] |= 0x00000010;
+ R_SVC[2] |= 0x00000010;
+ R_ABT[2] |= 0x00000010;
+ R_IRQ[2] |= 0x00000010;
+ R_UND[2] |= 0x00000010;
+
if (!Num)
{
SetupCodeMem(R[15]); // should fix it
((ARMv5*)this)->RegionCodeCycles = ((ARMv5*)this)->MemTimings[R[15] >> 12][0];
+
+ /*if ((CPSR & 0x1F) == 0x10)
+ ((ARMv5*)this)->PU_Map = ((ARMv5*)this)->PU_UserMap;
+ else
+ ((ARMv5*)this)->PU_Map = ((ARMv5*)this)->PU_PrivMap;*/
}
else
{
@@ -415,7 +429,7 @@ void ARM::RestoreCPSR()
UpdateMode(oldcpsr, CPSR);
}
-void ARM::UpdateMode(u32 oldmode, u32 newmode)
+void ARM::UpdateMode(u32 oldmode, u32 newmode, bool phony)
{
if ((oldmode & 0x1F) == (newmode & 0x1F)) return;
@@ -485,13 +499,12 @@ void ARM::UpdateMode(u32 oldmode, u32 newmode)
break;
}
- if (Num == 0)
+ if ((!phony) && (Num == 0))
{
/*if ((newmode & 0x1F) == 0x10)
((ARMv5*)this)->PU_Map = ((ARMv5*)this)->PU_UserMap;
else
((ARMv5*)this)->PU_Map = ((ARMv5*)this)->PU_PrivMap;*/
- //if ((newmode & 0x1F) == 0x10) printf("!! USER MODE\n");
}
}