aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bunnei <bunneidev@gmail.com>2014-08-26 23:58:03 -0400
committerGravatar bunnei <bunneidev@gmail.com>2014-08-28 17:51:49 -0400
commit304999dfebea595ea4a21082ed2ef9ea3f3d907f (patch)
tree12afac34844f348a342680441507e427f0f10441
parentfb908b939523395fd863e72453b3c8da84d8a74b (diff)
Threading: Fix thread starting to execute first instruction correctly.
-rw-r--r--src/core/arm/interpreter/arm_interpreter.cpp2
-rw-r--r--src/core/hle/kernel/thread.cpp5
2 files changed, 6 insertions, 1 deletions
diff --git a/src/core/arm/interpreter/arm_interpreter.cpp b/src/core/arm/interpreter/arm_interpreter.cpp
index d35a3ae1..0842d2f8 100644
--- a/src/core/arm/interpreter/arm_interpreter.cpp
+++ b/src/core/arm/interpreter/arm_interpreter.cpp
@@ -27,7 +27,7 @@ ARM_Interpreter::ARM_Interpreter() {
// Reset the core to initial state
ARMul_CoProInit(state);
ARMul_Reset(state);
- state->NextInstr = RESUME;
+ state->NextInstr = RESUME; // NOTE: This will be overwritten by LoadContext
state->Emulate = 3;
state->pc = state->Reg[15] = 0x00000000;
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 554ec975..8bd9ca1a 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -117,6 +117,11 @@ void ResetThread(Thread* t, u32 arg, s32 lowest_priority) {
t->context.sp = t->stack_top;
t->context.cpsr = 0x1F; // Usermode
+ // TODO(bunnei): This instructs the CPU core to start the execution as if it is "resuming" a
+ // thread. This is somewhat Sky-Eye specific, and should be re-architected in the future to be
+ // agnostic of the CPU core.
+ t->context.mode = 8;
+
if (t->current_priority < lowest_priority) {
t->current_priority = t->initial_priority;
}