浏览代码

Kernel: Detect support for CPUID FXSR

The fxsave and fxrstor instructions are available only if the FXSR
feature is present.
Jean-Baptiste Boric 4 年之前
父节点
当前提交
fea23d0ec1
共有 2 个文件被更改,包括 5 次插入0 次删除
  1. 4 0
      Kernel/Arch/i386/CPU.cpp
  2. 1 0
      Kernel/Arch/x86/CPU.h

+ 4 - 0
Kernel/Arch/i386/CPU.cpp

@@ -971,6 +971,8 @@ UNMAP_AFTER_INIT void Processor::cpu_detect()
         set_feature(CPUFeature::PGE);
     if (processor_info.edx() & (1 << 23))
         set_feature(CPUFeature::MMX);
+    if (processor_info.edx() & (1 << 24))
+        set_feature(CPUFeature::FXSR);
     if (processor_info.edx() & (1 << 25))
         set_feature(CPUFeature::SSE);
     if (processor_info.edx() & (1 << 26))
@@ -1137,6 +1139,8 @@ String Processor::features_string() const
             return "syscall";
         case CPUFeature::MMX:
             return "mmx";
+        case CPUFeature::FXSR:
+            return "fxsr";
         case CPUFeature::SSE2:
             return "sse2";
         case CPUFeature::SSE3:

+ 1 - 0
Kernel/Arch/x86/CPU.h

@@ -548,6 +548,7 @@ enum class CPUFeature : u32 {
     SSE4_2 = (1 << 20),
     XSAVE = (1 << 21),
     AVX = (1 << 22),
+    FXSR = (1 << 23),
 };
 
 class Thread;