1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 13:37:45 +00:00

Kernel: Move SMAP disabler RAII helper to its own file

Added this in a new directory called Kernel/Arch/x86/ where stuff
that applies to both i386 and x86_64 can live.
This commit is contained in:
Andreas Kling 2021-02-25 17:25:34 +01:00
parent 8f70528f30
commit 8129f3da52
9 changed files with 59 additions and 19 deletions

View file

@ -1137,22 +1137,4 @@ ALWAYS_INLINE void clac()
: "cc");
}
class SmapDisabler {
public:
ALWAYS_INLINE SmapDisabler()
{
m_flags = cpu_flags();
stac();
}
ALWAYS_INLINE ~SmapDisabler()
{
if (!(m_flags & 0x40000))
clac();
}
private:
u32 m_flags;
};
}