From e8a17ee6fdf7ab653be32f52afb10f0dafdf61c1 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sun, 1 Jun 2014 21:40:10 -0400 Subject: arm: added option to prepare CPU core (while mid-instruction) for thread reschedule --- src/core/arm/interpreter/arm_interpreter.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/core/arm/interpreter/arm_interpreter.cpp') diff --git a/src/core/arm/interpreter/arm_interpreter.cpp b/src/core/arm/interpreter/arm_interpreter.cpp index 17f787b86..2aa100e86 100644 --- a/src/core/arm/interpreter/arm_interpreter.cpp +++ b/src/core/arm/interpreter/arm_interpreter.cpp @@ -140,3 +140,8 @@ void ARM_Interpreter::LoadContext(const ThreadContext& ctx) { state->Reg[15] = ctx.pc; state->NextInstr = RESUME; } + +/// Prepare core for thread reschedule (if needed to correctly handle state) +void ARM_Interpreter::PrepareReschedule() { + state->NumInstrsToExecute = 0; +} -- cgit v1.2.3 From 9ece9da50d7c7827b9eb3bb9cfb007fb4af07061 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 5 Jun 2014 00:20:11 -0400 Subject: arm: fixed bug in how thread context switch occurs with SkyEye --- src/core/arm/interpreter/arm_interpreter.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/core/arm/interpreter/arm_interpreter.cpp') diff --git a/src/core/arm/interpreter/arm_interpreter.cpp b/src/core/arm/interpreter/arm_interpreter.cpp index 2aa100e86..8030ec56a 100644 --- a/src/core/arm/interpreter/arm_interpreter.cpp +++ b/src/core/arm/interpreter/arm_interpreter.cpp @@ -118,6 +118,9 @@ void ARM_Interpreter::SaveContext(ThreadContext& ctx) { ctx.fpscr = state->VFP[1]; ctx.fpexc = state->VFP[2]; + + ctx.reg_15 = state->Reg[15]; + ctx.mode = state->NextInstr; } /** @@ -137,8 +140,8 @@ void ARM_Interpreter::LoadContext(const ThreadContext& ctx) { state->VFP[1] = ctx.fpscr; state->VFP[2] = ctx.fpexc; - state->Reg[15] = ctx.pc; - state->NextInstr = RESUME; + state->Reg[15] = ctx.reg_15; + state->NextInstr = ctx.mode; } /// Prepare core for thread reschedule (if needed to correctly handle state) -- cgit v1.2.3 From 6cdad8390c20aed5c526916816388831d71213a2 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 5 Jun 2014 00:25:32 -0400 Subject: arm: fixed a bug where ARM_Interpreter::ExecuteInstructions was actually executing one more instruction than expected --- src/core/arm/interpreter/arm_interpreter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/arm/interpreter/arm_interpreter.cpp') diff --git a/src/core/arm/interpreter/arm_interpreter.cpp b/src/core/arm/interpreter/arm_interpreter.cpp index 8030ec56a..0e893f182 100644 --- a/src/core/arm/interpreter/arm_interpreter.cpp +++ b/src/core/arm/interpreter/arm_interpreter.cpp @@ -98,7 +98,7 @@ u64 ARM_Interpreter::GetTicks() const { * @param num_instructions Number of instructions to executes */ void ARM_Interpreter::ExecuteInstructions(int num_instructions) { - state->NumInstrsToExecute = num_instructions; + state->NumInstrsToExecute = num_instructions - 1; ARMul_Emulate32(state); } -- cgit v1.2.3