Add KInterruptBottomHalfGuard

This commit is contained in:
TuxSH authored and Michael Scire committed 2019-06-03 17:41:05 -07:00
1 parent 40b860c239
commit 7b726c3184
7 files changed
+47 -11

No files matched your search

@@ -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;
};
}