1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:57:44 +00:00

Kernel: Always inline stac(), clac() and SmapDisabler

Let's not be paying the function call overhead for these tiny ops.
Maybe there's an argument for having fewer gadgets in the kernel but
for now we're actually seeing stac() in profiles so let's put
that above theoretical security issues.
This commit is contained in:
Andreas Kling 2020-05-20 14:14:02 +02:00
parent e10183a6c5
commit 81d35c6891
2 changed files with 17 additions and 20 deletions

View file

@ -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();