summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-07-26 16:33:28 +0200
committerGitHub <noreply@github.com>2023-07-26 16:33:28 +0200
commitd3da1e6517fe27670b6c2d713d144872d55057d8 (patch)
treeab5c72b17b15185ec40945c5ba29400569b50630 /src/core/hle
parentMerge pull request #11142 from german77/avoid_crash (diff)
parentFixes and workarounds to make UBSan happier on macOS (diff)
downloadyuzu-d3da1e6517fe27670b6c2d713d144872d55057d8.tar
yuzu-d3da1e6517fe27670b6c2d713d144872d55057d8.tar.gz
yuzu-d3da1e6517fe27670b6c2d713d144872d55057d8.tar.bz2
yuzu-d3da1e6517fe27670b6c2d713d144872d55057d8.tar.lz
yuzu-d3da1e6517fe27670b6c2d713d144872d55057d8.tar.xz
yuzu-d3da1e6517fe27670b6c2d713d144872d55057d8.tar.zst
yuzu-d3da1e6517fe27670b6c2d713d144872d55057d8.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/kernel/k_auto_object.cpp4
-rw-r--r--src/core/hle/kernel/k_auto_object.h5
-rw-r--r--src/core/hle/kernel/k_scheduler.cpp3
-rw-r--r--src/core/hle/kernel/k_thread.cpp2
4 files changed, 8 insertions, 6 deletions
diff --git a/src/core/hle/kernel/k_auto_object.cpp b/src/core/hle/kernel/k_auto_object.cpp
index 0ae42c95c..9cd7a9fd5 100644
--- a/src/core/hle/kernel/k_auto_object.cpp
+++ b/src/core/hle/kernel/k_auto_object.cpp
@@ -15,8 +15,8 @@ void KAutoObject::RegisterWithKernel() {
m_kernel.RegisterKernelObject(this);
}
-void KAutoObject::UnregisterWithKernel() {
- m_kernel.UnregisterKernelObject(this);
+void KAutoObject::UnregisterWithKernel(KernelCore& kernel, KAutoObject* self) {
+ kernel.UnregisterKernelObject(self);
}
} // namespace Kernel
diff --git a/src/core/hle/kernel/k_auto_object.h b/src/core/hle/kernel/k_auto_object.h
index f384b1568..8d4e0df44 100644
--- a/src/core/hle/kernel/k_auto_object.h
+++ b/src/core/hle/kernel/k_auto_object.h
@@ -159,14 +159,15 @@ public:
// If ref count hits zero, destroy the object.
if (cur_ref_count - 1 == 0) {
+ KernelCore& kernel = m_kernel;
this->Destroy();
- this->UnregisterWithKernel();
+ KAutoObject::UnregisterWithKernel(kernel, this);
}
}
private:
void RegisterWithKernel();
- void UnregisterWithKernel();
+ static void UnregisterWithKernel(KernelCore& kernel, KAutoObject* self);
protected:
KernelCore& m_kernel;
diff --git a/src/core/hle/kernel/k_scheduler.cpp b/src/core/hle/kernel/k_scheduler.cpp
index 75ce5a23c..d8143c650 100644
--- a/src/core/hle/kernel/k_scheduler.cpp
+++ b/src/core/hle/kernel/k_scheduler.cpp
@@ -510,11 +510,12 @@ void KScheduler::Unload(KThread* thread) {
void KScheduler::Reload(KThread* thread) {
auto& cpu_core = m_kernel.System().ArmInterface(m_core_id);
+ auto* process = thread->GetOwnerProcess();
cpu_core.LoadContext(thread->GetContext32());
cpu_core.LoadContext(thread->GetContext64());
cpu_core.SetTlsAddress(GetInteger(thread->GetTlsAddress()));
cpu_core.SetTPIDR_EL0(thread->GetTpidrEl0());
- cpu_core.LoadWatchpointArray(thread->GetOwnerProcess()->GetWatchpoints());
+ cpu_core.LoadWatchpointArray(process ? &process->GetWatchpoints() : nullptr);
cpu_core.ClearExclusiveState();
}
diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp
index d88909889..7df8fd7f7 100644
--- a/src/core/hle/kernel/k_thread.cpp
+++ b/src/core/hle/kernel/k_thread.cpp
@@ -129,7 +129,7 @@ Result KThread::Initialize(KThreadFunction func, uintptr_t arg, KProcessAddress
case ThreadType::User:
ASSERT(((owner == nullptr) ||
(owner->GetCoreMask() | (1ULL << virt_core)) == owner->GetCoreMask()));
- ASSERT(((owner == nullptr) ||
+ ASSERT(((owner == nullptr) || (prio > Svc::LowestThreadPriority) ||
(owner->GetPriorityMask() | (1ULL << prio)) == owner->GetPriorityMask()));
break;
case ThreadType::Kernel: