kern: resolve MESOSPHERE_UNIMPLEMENTEDs other than UserException

This commit is contained in:
Michael Scire 2020-07-31 00:29:00 -07:00 committed by SciresM
parent 325802e29d
commit c9f8252577
4 changed files with 85 additions and 12 deletions

View file

@ -37,15 +37,19 @@ namespace ams::kern::svc {
/* Get the process from the object. */
KProcess *process = nullptr;
if (obj->IsDerivedFrom(KProcess::GetStaticTypeObj())) {
if (KProcess *p = obj->DynamicCast<KProcess *>(); p != nullptr) {
/* The object is a process, so we can use it directly. */
process = reinterpret_cast<KProcess *>(obj.GetPointerUnsafe());
} else if (obj->IsDerivedFrom(KThread::GetStaticTypeObj())) {
process = p;
} else if (KThread *t = obj->DynamicCast<KThread *>(); t != nullptr) {
/* The object is a thread, so we want to use its parent. */
process = reinterpret_cast<KThread *>(obj.GetPointerUnsafe())->GetOwnerProcess();
} else if (obj->IsDerivedFrom(KDebug::GetStaticTypeObj())) {
} else if (KDebug *d = obj->DynamicCast<KDebug *>(); d != nullptr) {
/* The object is a debug, so we want to use the process it's attached to. */
MESOSPHERE_UNIMPLEMENTED();
obj = d->GetProcess();
if (obj.IsNotNull()) {
process = static_cast<KProcess *>(obj.GetPointerUnsafe());
}
}
/* Make sure the target process exists. */