Add KInterruptBottomHalfGuard

This commit is contained in:
TuxSH
2018-11-07 12:03:25 +01:00
committed by Michael Scire
parent 40b860c239
commit 7b726c3184
7 changed files with 47 additions and 11 deletions

View File

@@ -0,0 +1,32 @@
#pragma once
#include <mesosphere/core/KCoreContext.hpp>
namespace mesosphere
{
class KThread;
inline void IncrementThreadInterruptBottomHalfLockCount(KThread &thread);
inline void DecrementThreadInterruptBottomHalfLockCount(KThread &thread);
class KInterruptBottomHalfGuard final {
public:
KInterruptBottomHalfGuard()
{
KThread *curThread = KCoreContext::GetCurrentInstance().GetCurrentThread();
IncrementInterruptBottomHalfLockCount(*curThread);
}
~KInterruptBottomHalfGuard()
{
KThread *curThread = KCoreContext::GetCurrentInstance().GetCurrentThread();
DecrementInterruptBottomHalfLockCount(*curThread);
}
KInterruptBottomHalfGuard(const KInterruptBottomHalfGuard &) = delete;
KInterruptBottomHalfGuard(KInterruptBottomHalfGuard &&) = delete;
KInterruptBottomHalfGuard &operator=(const KInterruptBottomHalfGuard &) = delete;
KInterruptBottomHalfGuard &operator=(KInterruptBottomHalfGuard &&) = delete;
};
}