summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-01-25 07:55:08 +0100
committerbunnei <bunneidev@gmail.com>2021-01-29 06:42:27 +0100
commit10738839ad7b9abbcf8ac64c6e58de63a9fbae76 (patch)
tree50c525de5000eae32108a13b65f976088513a76b /src/core/hle/kernel
parenthle: kernel: process: Add state lock. (diff)
downloadyuzu-10738839ad7b9abbcf8ac64c6e58de63a9fbae76.tar
yuzu-10738839ad7b9abbcf8ac64c6e58de63a9fbae76.tar.gz
yuzu-10738839ad7b9abbcf8ac64c6e58de63a9fbae76.tar.bz2
yuzu-10738839ad7b9abbcf8ac64c6e58de63a9fbae76.tar.lz
yuzu-10738839ad7b9abbcf8ac64c6e58de63a9fbae76.tar.xz
yuzu-10738839ad7b9abbcf8ac64c6e58de63a9fbae76.tar.zst
yuzu-10738839ad7b9abbcf8ac64c6e58de63a9fbae76.zip
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/k_thread.cpp15
-rw-r--r--src/core/hle/kernel/k_thread.h5
2 files changed, 13 insertions, 7 deletions
diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp
index f57e98047..45ad589d9 100644
--- a/src/core/hle/kernel/k_thread.cpp
+++ b/src/core/hle/kernel/k_thread.cpp
@@ -101,11 +101,12 @@ ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_s
UNREACHABLE_MSG("KThread::Initialize: Unknown ThreadType {}", static_cast<u32>(type));
break;
}
+ thread_type_for_debugging = type;
// Set the ideal core ID and affinity mask.
virtual_ideal_core_id = virt_core;
physical_ideal_core_id = phys_core;
- virtual_affinity_mask = (static_cast<u64>(1) << virt_core);
+ virtual_affinity_mask = 1ULL << virt_core;
physical_affinity_mask.SetAffinity(phys_core, true);
// Set the thread state.
@@ -353,7 +354,7 @@ void KThread::Unpin() {
// Enable core migration.
ASSERT(num_core_migration_disables == 1);
{
- --num_core_migration_disables;
+ num_core_migration_disables--;
// Restore our original state.
const KAffinityMask old_mask = physical_affinity_mask;
@@ -494,8 +495,8 @@ ResultCode KThread::SetCoreMask(s32 core_id, u64 v_affinity_mask) {
// Update the pinned waiter list.
{
- bool retry_update = false;
- bool thread_is_pinned = false;
+ bool retry_update{};
+ bool thread_is_pinned{};
do {
// Lock the scheduler.
KScopedSchedulerLock sl{kernel};
@@ -507,7 +508,7 @@ ResultCode KThread::SetCoreMask(s32 core_id, u64 v_affinity_mask) {
retry_update = false;
// Check if the thread is currently running.
- bool thread_is_current = false;
+ bool thread_is_current{};
s32 thread_core;
for (thread_core = 0; thread_core < static_cast<s32>(Core::Hardware::NUM_CPU_CORES);
++thread_core) {
@@ -683,8 +684,8 @@ ResultCode KThread::SetActivity(Svc::ThreadActivity activity) {
// If the thread is now paused, update the pinned waiter list.
if (activity == Svc::ThreadActivity::Paused) {
- bool thread_is_pinned = false;
- bool thread_is_current;
+ bool thread_is_pinned{};
+ bool thread_is_current{};
do {
// Lock the scheduler.
KScopedSchedulerLock sl{kernel};
diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h
index eeddf5a65..c8ac656a4 100644
--- a/src/core/hle/kernel/k_thread.h
+++ b/src/core/hle/kernel/k_thread.h
@@ -534,6 +534,10 @@ public:
return wait_reason_for_debugging;
}
+ [[nodiscard]] ThreadType GetThreadTypeForDebugging() const {
+ return thread_type_for_debugging;
+ }
+
void SetWaitObjectsForDebugging(const std::span<KSynchronizationObject*>& objects) {
wait_objects_for_debugging.clear();
wait_objects_for_debugging.reserve(objects.size());
@@ -721,6 +725,7 @@ private:
std::vector<KSynchronizationObject*> wait_objects_for_debugging;
VAddr mutex_wait_address_for_debugging{};
ThreadWaitReasonForDebugging wait_reason_for_debugging{};
+ ThreadType thread_type_for_debugging{};
std::string name;
public: