From cef4af53c9f3f4f280520e6ccb3650cb53408a03 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sun, 15 Mar 2026 14:38:11 +0000 Subject: [PATCH] x86_64: add pre-processor token to control hardware rng --- arch/x86_64/init.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86_64/init.c b/arch/x86_64/init.c index a4e6d98..903c93b 100644 --- a/arch/x86_64/init.c +++ b/arch/x86_64/init.c @@ -20,6 +20,8 @@ #include #include +#undef HARDWARE_RNG + #define PTR32(x) ((void *)((uintptr_t)(x))) /* the physical address of the start of the memblock heap. @@ -125,17 +127,21 @@ int ml_init(uintptr_t arg) reserve_end = bsp.mod_base + bsp.mod_size; } +#if defined(HARDWARE_RNG) if (ml_hwrng_available()) { printk("cpu: ardware RNG available"); uint64_t seed = ml_hwrng_generate(); printk("cpu: RNG seed=%zx", seed); init_random(seed); } else { +#endif printk("cpu: hardware RNG unavailable"); uint64_t seed = 0xeddc4c8a679dc23f; printk("cpu: RNG seed=%zx", seed); init_random(seed); +#if defined(HARDWARE_RNG) } +#endif early_vm_init(reserve_end);