summaryrefslogtreecommitdiff
path: root/Kernel/Arch/i386
diff options
context:
space:
mode:
author3541 <alex@emobrien.com>2020-06-27 15:15:54 +1000
committerAndreas Kling <kling@serenityos.org>2020-06-27 12:57:03 +0200
commit4fa6301523bc9d4fad1f6c2f6b6a7b9a8e40d758 (patch)
tree461421079bd29312e32f9268ab9c49c53473d2ce /Kernel/Arch/i386
parentebbcef926a02e211ebb44bcf029efd839059616a (diff)
downloadserenity-4fa6301523bc9d4fad1f6c2f6b6a7b9a8e40d758.zip
Kernel: Add g_cpu_supports_rdseed
CPUs which support RDRAND do not necessarily support RDSEED. This introduces a flag g_cpu_supports_rdseed which is set appropriately by CPUID. This causes Haswell CPUs in particular (and probably a lot of AMD chips) to now fail to boot with #2634, rather than an illegal instruction. It seems like the KernelRng needs either an initial reseed call or more random events added before the first call to get_good_random, but I don't feel qualified to make that kind of change.
Diffstat (limited to 'Kernel/Arch/i386')
-rw-r--r--Kernel/Arch/i386/CPU.cpp2
-rw-r--r--Kernel/Arch/i386/CPU.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/Kernel/Arch/i386/CPU.cpp b/Kernel/Arch/i386/CPU.cpp
index 9ad0b6ff43..354447d5c5 100644
--- a/Kernel/Arch/i386/CPU.cpp
+++ b/Kernel/Arch/i386/CPU.cpp
@@ -714,6 +714,7 @@ bool g_cpu_supports_nx;
bool g_cpu_supports_pae;
bool g_cpu_supports_pge;
bool g_cpu_supports_rdrand;
+bool g_cpu_supports_rdseed;
bool g_cpu_supports_smap;
bool g_cpu_supports_smep;
bool g_cpu_supports_sse;
@@ -736,6 +737,7 @@ void cpu_detect()
g_cpu_supports_smap = (extended_features.ebx() & (1 << 20));
g_cpu_supports_smep = (extended_features.ebx() & (1 << 7));
g_cpu_supports_umip = (extended_features.ecx() & (1 << 2));
+ g_cpu_supports_rdseed = (extended_features.ebx() & (1 << 18));
}
void cpu_setup()
diff --git a/Kernel/Arch/i386/CPU.h b/Kernel/Arch/i386/CPU.h
index b59819bc3f..398bbcd69d 100644
--- a/Kernel/Arch/i386/CPU.h
+++ b/Kernel/Arch/i386/CPU.h
@@ -588,6 +588,7 @@ extern bool g_cpu_supports_nx;
extern bool g_cpu_supports_pae;
extern bool g_cpu_supports_pge;
extern bool g_cpu_supports_rdrand;
+extern bool g_cpu_supports_rdseed;
extern bool g_cpu_supports_smap;
extern bool g_cpu_supports_smep;
extern bool g_cpu_supports_sse;