From 232ef55c1a13552e5ba8b72d61d1d072f5851598 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 15 Dec 2016 19:01:48 -0500 Subject: core: Consolidate core and system state, remove system module & cleanups. --- src/core/hle/kernel/thread.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/core/hle/kernel') diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 18b696f72..91c05fc42 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -188,7 +188,7 @@ static void SwitchContext(Thread* new_thread) { // Save context for previous thread if (previous_thread) { previous_thread->last_running_ticks = CoreTiming::GetTicks(); - Core::g_app_core->SaveContext(previous_thread->context); + Core::AppCore().SaveContext(previous_thread->context); if (previous_thread->status == THREADSTATUS_RUNNING) { // This is only the case when a reschedule is triggered without the current thread @@ -214,8 +214,8 @@ static void SwitchContext(Thread* new_thread) { // Restores thread to its nominal priority if it has been temporarily changed new_thread->current_priority = new_thread->nominal_priority; - Core::g_app_core->LoadContext(new_thread->context); - Core::g_app_core->SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress()); + Core::AppCore().LoadContext(new_thread->context); + Core::AppCore().SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress()); } else { current_thread = nullptr; } -- cgit v1.2.3 From 4fc8b8229ed1d9ea9d20faee7059c898265db6cf Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 16 Dec 2016 00:37:38 -0500 Subject: core: Remove HLE module, consolidate code & various cleanups. --- src/core/hle/kernel/address_arbiter.cpp | 1 - src/core/hle/kernel/kernel.h | 3 ++- src/core/hle/kernel/thread.cpp | 5 +---- src/core/hle/kernel/thread.h | 1 - 4 files changed, 3 insertions(+), 7 deletions(-) (limited to 'src/core/hle/kernel') diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp index b5a0cc3a3..01fab123e 100644 --- a/src/core/hle/kernel/address_arbiter.cpp +++ b/src/core/hle/kernel/address_arbiter.cpp @@ -4,7 +4,6 @@ #include "common/common_types.h" #include "common/logging/log.h" -#include "core/hle/hle.h" #include "core/hle/kernel/address_arbiter.h" #include "core/hle/kernel/thread.h" #include "core/memory.h" diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 1adcf6c71..9503e7d04 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -11,11 +11,12 @@ #include #include #include "common/common_types.h" -#include "core/hle/hle.h" #include "core/hle/result.h" namespace Kernel { +using Handle = u32; + class Thread; // TODO: Verify code diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 91c05fc42..c964b35d4 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -14,7 +14,6 @@ #include "core/arm/skyeye_common/armstate.h" #include "core/core.h" #include "core/core_timing.h" -#include "core/hle/hle.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/memory.h" #include "core/hle/kernel/mutex.h" @@ -330,7 +329,7 @@ void Thread::ResumeFromWait() { ready_queue.push_back(current_priority, this); status = THREADSTATUS_READY; - HLE::Reschedule(__func__); + Core::System::GetInstance().PrepareReschedule(); } /** @@ -545,8 +544,6 @@ void Reschedule() { Thread* cur = GetCurrentThread(); Thread* next = PopNextReadyThread(); - HLE::DoneRescheduling(); - if (cur && next) { LOG_TRACE(Kernel, "context switch %u -> %u", cur->GetObjectId(), next->GetObjectId()); } else if (cur) { diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index d4fefc573..89acc12c1 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h @@ -11,7 +11,6 @@ #include #include "common/common_types.h" #include "core/core.h" -#include "core/hle/hle.h" #include "core/hle/kernel/kernel.h" #include "core/hle/result.h" -- cgit v1.2.3 From e26fbfd1d72c026d0f25c09595e7123459b1734f Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 22 Dec 2016 00:00:01 -0500 Subject: core: Replace "AppCore" nomenclature with just "CPU". --- src/core/hle/kernel/thread.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/core/hle/kernel') diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index c964b35d4..60b7bea70 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -187,7 +187,7 @@ static void SwitchContext(Thread* new_thread) { // Save context for previous thread if (previous_thread) { previous_thread->last_running_ticks = CoreTiming::GetTicks(); - Core::AppCore().SaveContext(previous_thread->context); + Core::CPU().SaveContext(previous_thread->context); if (previous_thread->status == THREADSTATUS_RUNNING) { // This is only the case when a reschedule is triggered without the current thread @@ -213,8 +213,8 @@ static void SwitchContext(Thread* new_thread) { // Restores thread to its nominal priority if it has been temporarily changed new_thread->current_priority = new_thread->nominal_priority; - Core::AppCore().LoadContext(new_thread->context); - Core::AppCore().SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress()); + Core::CPU().LoadContext(new_thread->context); + Core::CPU().SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress()); } else { current_thread = nullptr; } -- cgit v1.2.3 From 8b1e269e5898ad0b6aadabee41fea777f0e62fdc Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 22 Dec 2016 00:08:09 -0500 Subject: ThreadContext: Move from "core" to "arm_interface". --- src/core/hle/kernel/thread.cpp | 6 +++--- src/core/hle/kernel/thread.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/core/hle/kernel') 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 GetFreeThreadLocalSlot(std::vector>& 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 #include #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; -- cgit v1.2.3