forked from ShuriZma/suyu
core: hle: kernel: Disable dispatch count tracking on single core.
- This would have limited value, and would be a mess to handle properly.
This commit is contained in:
parent
d14b8fc747
commit
3dc803a430
|
@ -32,7 +32,7 @@ void CpuManager::Initialize() {
|
||||||
core_data[core].host_thread = std::jthread(ThreadStart, std::ref(*this), core);
|
core_data[core].host_thread = std::jthread(ThreadStart, std::ref(*this), core);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
core_data[0].host_thread = std::jthread(ThreadStart, std::ref(*this), -1);
|
core_data[0].host_thread = std::jthread(ThreadStart, std::ref(*this), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,9 @@
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/fiber.h"
|
#include "common/fiber.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
|
#include "common/scope_exit.h"
|
||||||
|
#include "common/settings.h"
|
||||||
|
#include "common/thread_queue_list.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/cpu_manager.h"
|
#include "core/cpu_manager.h"
|
||||||
#include "core/hardware_properties.h"
|
#include "core/hardware_properties.h"
|
||||||
|
@ -211,9 +214,10 @@ ResultCode KThread::InitializeThread(KThread* thread, KThreadFunction func, uint
|
||||||
// Initialize the thread.
|
// Initialize the thread.
|
||||||
R_TRY(thread->Initialize(func, arg, user_stack_top, prio, core, owner, type));
|
R_TRY(thread->Initialize(func, arg, user_stack_top, prio, core, owner, type));
|
||||||
|
|
||||||
// Initialize host context.
|
// Initialize emulation parameters.
|
||||||
thread->host_context =
|
thread->host_context =
|
||||||
std::make_shared<Common::Fiber>(std::move(init_func), init_func_parameter);
|
std::make_shared<Common::Fiber>(std::move(init_func), init_func_parameter);
|
||||||
|
thread->is_single_core = !Settings::values.use_multi_core.GetValue();
|
||||||
|
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
|
@ -454,8 +454,12 @@ public:
|
||||||
return GetActiveCore() == 3;
|
return GetActiveCore() == 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] bool IsDispatchTrackingDisabled() const {
|
||||||
|
return is_single_core || IsKernelThread();
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] s32 GetDisableDispatchCount() const {
|
[[nodiscard]] s32 GetDisableDispatchCount() const {
|
||||||
if (IsKernelThread()) {
|
if (IsDispatchTrackingDisabled()) {
|
||||||
// TODO(bunnei): Until kernel threads are emulated, we cannot enable/disable dispatch.
|
// TODO(bunnei): Until kernel threads are emulated, we cannot enable/disable dispatch.
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -464,7 +468,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisableDispatch() {
|
void DisableDispatch() {
|
||||||
if (IsKernelThread()) {
|
if (IsDispatchTrackingDisabled()) {
|
||||||
// TODO(bunnei): Until kernel threads are emulated, we cannot enable/disable dispatch.
|
// TODO(bunnei): Until kernel threads are emulated, we cannot enable/disable dispatch.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -474,7 +478,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnableDispatch() {
|
void EnableDispatch() {
|
||||||
if (IsKernelThread()) {
|
if (IsDispatchTrackingDisabled()) {
|
||||||
// TODO(bunnei): Until kernel threads are emulated, we cannot enable/disable dispatch.
|
// TODO(bunnei): Until kernel threads are emulated, we cannot enable/disable dispatch.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -727,6 +731,7 @@ private:
|
||||||
|
|
||||||
// For emulation
|
// For emulation
|
||||||
std::shared_ptr<Common::Fiber> host_context{};
|
std::shared_ptr<Common::Fiber> host_context{};
|
||||||
|
bool is_single_core{};
|
||||||
|
|
||||||
// For debugging
|
// For debugging
|
||||||
std::vector<KSynchronizationObject*> wait_objects_for_debugging;
|
std::vector<KSynchronizationObject*> wait_objects_for_debugging;
|
||||||
|
|
Loading…
Reference in New Issue