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.
This commit is contained in:
3541 2020-06-27 15:15:54 +10:00 committed by Andreas Kling
commit 4fa6301523
Notes: sideshowbarker 2024-07-19 05:21:50 +09:00
3 changed files with 4 additions and 1 deletions

View file

@ -44,7 +44,7 @@ KernelRng& KernelRng::the()
KernelRng::KernelRng()
{
if (g_cpu_supports_rdrand) {
if (g_cpu_supports_rdseed) {
for (size_t i = 0; i < resource().pool_count * resource().reseed_threshold; ++i) {
u32 value = 0;
asm volatile(