kern: SvcReturnFromException

This commit is contained in:
Michael Scire 2020-07-31 05:52:59 -07:00 committed by SciresM
parent 8cd81b3092
commit 5d462c626c
11 changed files with 647 additions and 56 deletions

View file

@ -312,6 +312,32 @@ namespace ams::kern {
}
}
ALWAYS_INLINE void CopyEnterExceptionSvcPermissionsTo(KThread::StackParameters &sp) {
static_assert(sizeof(svc_access_flags) == sizeof(sp.svc_permission));
/* Set ReturnFromException if allowed. */
if (GetSvcAllowedImpl(this->svc_access_flags, svc::SvcId_ReturnFromException)) {
SetSvcAllowedImpl(sp.svc_permission, svc::SvcId_ReturnFromException);
}
/* Set GetInfo if allowed. */
if (GetSvcAllowedImpl(this->svc_access_flags, svc::SvcId_GetInfo)) {
SetSvcAllowedImpl(sp.svc_permission, svc::SvcId_GetInfo);
}
}
ALWAYS_INLINE void CopyLeaveExceptionSvcPermissionsTo(KThread::StackParameters &sp) {
static_assert(sizeof(svc_access_flags) == sizeof(sp.svc_permission));
/* Clear ReturnFromException. */
ClearSvcAllowedImpl(sp.svc_permission, svc::SvcId_ReturnFromException);
/* If pinned, clear GetInfo. */
if (sp.is_pinned) {
ClearSvcAllowedImpl(sp.svc_permission, svc::SvcId_GetInfo);
}
}
constexpr bool IsPermittedInterrupt(u32 id) const {
constexpr size_t BitsPerWord = BITSIZEOF(this->irq_access_flags[0]);
if (id < BITSIZEOF(this->irq_access_flags)) {