summaryrefslogtreecommitdiff
path: root/Kernel/Arch/i386
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Arch/i386')
-rw-r--r--Kernel/Arch/i386/CPU.cpp16
-rw-r--r--Kernel/Arch/i386/CPU.h21
2 files changed, 17 insertions, 20 deletions
diff --git a/Kernel/Arch/i386/CPU.cpp b/Kernel/Arch/i386/CPU.cpp
index 11909c4cfb..affd7705d1 100644
--- a/Kernel/Arch/i386/CPU.cpp
+++ b/Kernel/Arch/i386/CPU.cpp
@@ -734,22 +734,6 @@ void cpu_detect()
g_cpu_supports_umip = (extended_features.ecx() & (1 << 2));
}
-void stac()
-{
- if (!g_cpu_supports_smap)
- return;
- asm volatile("stac" ::
- : "cc");
-}
-
-void clac()
-{
- if (!g_cpu_supports_smap)
- return;
- asm volatile("clac" ::
- : "cc");
-}
-
void cpu_setup()
{
cpu_detect();
diff --git a/Kernel/Arch/i386/CPU.h b/Kernel/Arch/i386/CPU.h
index 6cc85461b3..9b6e771be0 100644
--- a/Kernel/Arch/i386/CPU.h
+++ b/Kernel/Arch/i386/CPU.h
@@ -584,18 +584,31 @@ extern bool g_cpu_supports_sse;
extern bool g_cpu_supports_tsc;
extern bool g_cpu_supports_umip;
-void stac();
-void clac();
+ALWAYS_INLINE void stac()
+{
+ if (!g_cpu_supports_smap)
+ return;
+ asm volatile("stac" ::
+ : "cc");
+}
+
+ALWAYS_INLINE void clac()
+{
+ if (!g_cpu_supports_smap)
+ return;
+ asm volatile("clac" ::
+ : "cc");
+}
class SmapDisabler {
public:
- SmapDisabler()
+ ALWAYS_INLINE SmapDisabler()
{
m_flags = cpu_flags();
stac();
}
- ~SmapDisabler()
+ ALWAYS_INLINE ~SmapDisabler()
{
if (!(m_flags & 0x40000))
clac();