kern: implement SvcGetThreadContext3

This commit is contained in:
Michael Scire 2020-07-28 03:56:47 -07:00 committed by SciresM
commit 4bb9ef061a
7 changed files with 139 additions and 3 deletions

View file

@ -854,6 +854,27 @@ namespace ams::kern {
return ResultSuccess();
}
Result KThread::GetThreadContext3(ams::svc::ThreadContext *out) {
/* Lock ourselves. */
KScopedLightLock lk(this->activity_pause_lock);
/* Get the context. */
{
/* Lock the scheduler. */
KScopedSchedulerLock sl;
/* Verify that we're suspended. */
R_UNLESS(this->IsSuspendRequested(SuspendType_Thread), svc::ResultInvalidState());
/* If we're not terminating, get the thread's user context. */
if (!this->IsTerminationRequested()) {
GetUserContext(out, this);
}
}
return ResultSuccess();
}
void KThread::AddWaiterImpl(KThread *thread) {
MESOSPHERE_ASSERT_THIS();
MESOSPHERE_ASSERT(KScheduler::IsSchedulerLockedByCurrentThread());