diff options
author | bunnei <bunneidev@gmail.com> | 2021-08-14 11:14:19 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2021-12-07 01:39:17 +0100 |
commit | 3dc803a430107fb22ffc91608c613e09ec5c8b51 (patch) | |
tree | f8d5a747cf9d89befd89beec16bdc116d2725fe8 | |
parent | core: hle: kernel: k_thread: Mark KScopedDisableDispatch as nodiscard. (diff) | |
download | yuzu-3dc803a430107fb22ffc91608c613e09ec5c8b51.tar yuzu-3dc803a430107fb22ffc91608c613e09ec5c8b51.tar.gz yuzu-3dc803a430107fb22ffc91608c613e09ec5c8b51.tar.bz2 yuzu-3dc803a430107fb22ffc91608c613e09ec5c8b51.tar.lz yuzu-3dc803a430107fb22ffc91608c613e09ec5c8b51.tar.xz yuzu-3dc803a430107fb22ffc91608c613e09ec5c8b51.tar.zst yuzu-3dc803a430107fb22ffc91608c613e09ec5c8b51.zip |
-rw-r--r-- | src/core/cpu_manager.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/k_thread.cpp | 6 | ||||
-rw-r--r-- | src/core/hle/kernel/k_thread.h | 11 |
3 files changed, 14 insertions, 5 deletions
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index d9bd5b665..cbcc54891 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp @@ -32,7 +32,7 @@ void CpuManager::Initialize() { core_data[core].host_thread = std::jthread(ThreadStart, std::ref(*this), core); } } 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); } } diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp index de94c737d..41bf9a6bb 100644 --- a/src/core/hle/kernel/k_thread.cpp +++ b/src/core/hle/kernel/k_thread.cpp @@ -13,6 +13,9 @@ #include "common/common_types.h" #include "common/fiber.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/cpu_manager.h" #include "core/hardware_properties.h" @@ -211,9 +214,10 @@ ResultCode KThread::InitializeThread(KThread* thread, KThreadFunction func, uint // Initialize the thread. R_TRY(thread->Initialize(func, arg, user_stack_top, prio, core, owner, type)); - // Initialize host context. + // Initialize emulation parameters. thread->host_context = std::make_shared<Common::Fiber>(std::move(init_func), init_func_parameter); + thread->is_single_core = !Settings::values.use_multi_core.GetValue(); return ResultSuccess; } diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h index 8bbf66c52..e4c4c877d 100644 --- a/src/core/hle/kernel/k_thread.h +++ b/src/core/hle/kernel/k_thread.h @@ -454,8 +454,12 @@ public: return GetActiveCore() == 3; } + [[nodiscard]] bool IsDispatchTrackingDisabled() const { + return is_single_core || IsKernelThread(); + } + [[nodiscard]] s32 GetDisableDispatchCount() const { - if (IsKernelThread()) { + if (IsDispatchTrackingDisabled()) { // TODO(bunnei): Until kernel threads are emulated, we cannot enable/disable dispatch. return 1; } @@ -464,7 +468,7 @@ public: } void DisableDispatch() { - if (IsKernelThread()) { + if (IsDispatchTrackingDisabled()) { // TODO(bunnei): Until kernel threads are emulated, we cannot enable/disable dispatch. return; } @@ -474,7 +478,7 @@ public: } void EnableDispatch() { - if (IsKernelThread()) { + if (IsDispatchTrackingDisabled()) { // TODO(bunnei): Until kernel threads are emulated, we cannot enable/disable dispatch. return; } @@ -727,6 +731,7 @@ private: // For emulation std::shared_ptr<Common::Fiber> host_context{}; + bool is_single_core{}; // For debugging std::vector<KSynchronizationObject*> wait_objects_for_debugging; |