mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-20 21:00:52 +01:00
Threading: Fix thread starting to execute first instruction correctly.
This commit is contained in:
parent
ae93adddd1
commit
3ade84cb7b
2 changed files with 6 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue