diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/arm/arm_interface.h | 19 | ||||
-rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic.cpp | 4 | ||||
-rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic.h | 8 | ||||
-rw-r--r-- | src/core/arm/dyncom/arm_dyncom.cpp | 4 | ||||
-rw-r--r-- | src/core/arm/dyncom/arm_dyncom.h | 8 | ||||
-rw-r--r-- | src/core/core.h | 11 | ||||
-rw-r--r-- | src/core/hle/kernel/thread.cpp | 6 | ||||
-rw-r--r-- | src/core/hle/kernel/thread.h | 3 |
8 files changed, 26 insertions, 37 deletions
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index e466b21b2..ccd43f431 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h @@ -8,15 +8,22 @@ #include "core/arm/skyeye_common/arm_regformat.h" #include "core/arm/skyeye_common/vfp/asm_vfp.h" -namespace Core { -struct ThreadContext; -} - /// Generic ARM11 CPU interface class ARM_Interface : NonCopyable { public: virtual ~ARM_Interface() {} + struct ThreadContext { + u32 cpu_registers[13]; + u32 sp; + u32 lr; + u32 pc; + u32 cpsr; + u32 fpu_registers[64]; + u32 fpscr; + u32 fpexc; + }; + /** * Runs the CPU for the given number of instructions * @param num_instructions Number of instructions to run @@ -124,13 +131,13 @@ public: * Saves the current CPU context * @param ctx Thread context to save */ - virtual void SaveContext(Core::ThreadContext& ctx) = 0; + virtual void SaveContext(ThreadContext& ctx) = 0; /** * Loads a CPU context * @param ctx Thread context to load */ - virtual void LoadContext(const Core::ThreadContext& ctx) = 0; + virtual void LoadContext(const ThreadContext& ctx) = 0; /// Prepare core for thread reschedule (if needed to correctly handle state) virtual void PrepareReschedule() = 0; diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp index fc4254670..5290382ff 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic.cpp @@ -137,7 +137,7 @@ void ARM_Dynarmic::ExecuteInstructions(int num_instructions) { AddTicks(ticks_executed); } -void ARM_Dynarmic::SaveContext(Core::ThreadContext& ctx) { +void ARM_Dynarmic::SaveContext(ARM_Interface::ThreadContext& ctx) { memcpy(ctx.cpu_registers, jit->Regs().data(), sizeof(ctx.cpu_registers)); memcpy(ctx.fpu_registers, jit->ExtRegs().data(), sizeof(ctx.fpu_registers)); @@ -150,7 +150,7 @@ void ARM_Dynarmic::SaveContext(Core::ThreadContext& ctx) { ctx.fpexc = interpreter_state->VFP[VFP_FPEXC]; } -void ARM_Dynarmic::LoadContext(const Core::ThreadContext& ctx) { +void ARM_Dynarmic::LoadContext(const ARM_Interface::ThreadContext& ctx) { memcpy(jit->Regs().data(), ctx.cpu_registers, sizeof(ctx.cpu_registers)); memcpy(jit->ExtRegs().data(), ctx.fpu_registers, sizeof(ctx.fpu_registers)); diff --git a/src/core/arm/dynarmic/arm_dynarmic.h b/src/core/arm/dynarmic/arm_dynarmic.h index ced86d29b..87ab53d81 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.h +++ b/src/core/arm/dynarmic/arm_dynarmic.h @@ -10,10 +10,6 @@ #include "core/arm/arm_interface.h" #include "core/arm/skyeye_common/armstate.h" -namespace Core { -struct ThreadContext; -} - class ARM_Dynarmic final : public ARM_Interface { public: ARM_Dynarmic(PrivilegeMode initial_mode); @@ -33,8 +29,8 @@ public: void AddTicks(u64 ticks) override; - void SaveContext(Core::ThreadContext& ctx) override; - void LoadContext(const Core::ThreadContext& ctx) override; + void SaveContext(ThreadContext& ctx) override; + void LoadContext(const ThreadContext& ctx) override; void PrepareReschedule() override; void ExecuteInstructions(int num_instructions) override; diff --git a/src/core/arm/dyncom/arm_dyncom.cpp b/src/core/arm/dyncom/arm_dyncom.cpp index 34c7f945e..81f9bf99e 100644 --- a/src/core/arm/dyncom/arm_dyncom.cpp +++ b/src/core/arm/dyncom/arm_dyncom.cpp @@ -89,7 +89,7 @@ void ARM_DynCom::ExecuteInstructions(int num_instructions) { AddTicks(ticks_executed); } -void ARM_DynCom::SaveContext(Core::ThreadContext& ctx) { +void ARM_DynCom::SaveContext(ThreadContext& ctx) { memcpy(ctx.cpu_registers, state->Reg.data(), sizeof(ctx.cpu_registers)); memcpy(ctx.fpu_registers, state->ExtReg.data(), sizeof(ctx.fpu_registers)); @@ -102,7 +102,7 @@ void ARM_DynCom::SaveContext(Core::ThreadContext& ctx) { ctx.fpexc = state->VFP[VFP_FPEXC]; } -void ARM_DynCom::LoadContext(const Core::ThreadContext& ctx) { +void ARM_DynCom::LoadContext(const ThreadContext& ctx) { memcpy(state->Reg.data(), ctx.cpu_registers, sizeof(ctx.cpu_registers)); memcpy(state->ExtReg.data(), ctx.fpu_registers, sizeof(ctx.fpu_registers)); diff --git a/src/core/arm/dyncom/arm_dyncom.h b/src/core/arm/dyncom/arm_dyncom.h index 65db1f0f9..62c174f3c 100644 --- a/src/core/arm/dyncom/arm_dyncom.h +++ b/src/core/arm/dyncom/arm_dyncom.h @@ -10,10 +10,6 @@ #include "core/arm/skyeye_common/arm_regformat.h" #include "core/arm/skyeye_common/armstate.h" -namespace Core { -struct ThreadContext; -} - class ARM_DynCom final : public ARM_Interface { public: ARM_DynCom(PrivilegeMode initial_mode); @@ -36,8 +32,8 @@ public: void AddTicks(u64 ticks) override; - void SaveContext(Core::ThreadContext& ctx) override; - void LoadContext(const Core::ThreadContext& ctx) override; + void SaveContext(ThreadContext& ctx) override; + void LoadContext(const ThreadContext& ctx) override; void PrepareReschedule() override; void ExecuteInstructions(int num_instructions) override; diff --git a/src/core/core.h b/src/core/core.h index b0f8df441..1015e8847 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -19,17 +19,6 @@ class AppLoader; namespace Core { -struct ThreadContext { - u32 cpu_registers[13]; - u32 sp; - u32 lr; - u32 pc; - u32 cpsr; - u32 fpu_registers[64]; - u32 fpscr; - u32 fpexc; -}; - class System { public: /** diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 60b7bea70..5fb95dada 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -384,9 +384,9 @@ std::tuple<u32, u32, bool> GetFreeThreadLocalSlot(std::vector<std::bitset<8>>& t * @param entry_point Address of entry point for execution * @param arg User argument for thread */ -static void ResetThreadContext(Core::ThreadContext& context, u32 stack_top, u32 entry_point, - u32 arg) { - memset(&context, 0, sizeof(Core::ThreadContext)); +static void ResetThreadContext(ARM_Interface::ThreadContext& context, u32 stack_top, + u32 entry_point, u32 arg) { + memset(&context, 0, sizeof(ARM_Interface::ThreadContext)); context.cpu_registers[0] = arg; context.pc = entry_point; diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index 89acc12c1..c77ac644d 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h @@ -10,6 +10,7 @@ #include <boost/container/flat_map.hpp> #include <boost/container/flat_set.hpp> #include "common/common_types.h" +#include "core/arm/arm_interface.h" #include "core/core.h" #include "core/hle/kernel/kernel.h" #include "core/hle/result.h" @@ -157,7 +158,7 @@ public: return !wait_objects.empty(); } - Core::ThreadContext context; + ARM_Interface::ThreadContext context; u32 thread_id; |