refactor: Optimize the signal context overhead
[lunaix-os.git] / lunaix-os / hal / cpu.c
index 9517445e1e2b31938391c86254f3ffffd9fb4452..77059b603ba51009622921a1329ee3b737c23b4e 100644 (file)
@@ -1,5 +1,6 @@
 #include <cpuid.h>
 #include <hal/cpu.h>
+#include <hal/rnd.h>
 #include <stdint.h>
 
 void
@@ -69,4 +70,12 @@ void
 cpu_wrmsr(u32_t msr_idx, u32_t reg_high, u32_t reg_low)
 {
     asm volatile("wrmsr" : : "d"(reg_high), "a"(reg_low), "c"(msr_idx));
+}
+
+int
+rnd_is_supported()
+{
+    reg32 eax = 0, ebx = 0, ecx = 0, edx = 0;
+    __get_cpuid(0x01, &eax, &ebx, &ecx, &edx);
+    return (ecx & (1 << 30));
 }
\ No newline at end of file