From e5775722990f6dded6da3082e7aa9d2de7316d1f Mon Sep 17 00:00:00 2001 From: koniifer Date: Thu, 12 Sep 2024 19:44:27 +0100 Subject: [PATCH] amazing random driver update --- kernel/src/arch/aarch64/mod.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/kernel/src/arch/aarch64/mod.rs b/kernel/src/arch/aarch64/mod.rs index 54b1a26b..6de4a918 100644 --- a/kernel/src/arch/aarch64/mod.rs +++ b/kernel/src/arch/aarch64/mod.rs @@ -103,15 +103,17 @@ pub fn spin_loop() -> ! { } } +static mut A_REAL_RANDOM_U64_I_PROMISE: u64 = 0; + pub fn hardware_random_u64() -> u64 { if let Some(rng) = aarch64_cpu::asm::random::ArmRng::new() { if let Some(rnd) = rng.rndr() { - rnd - } else { - panic!("RNG failure :(") + return rnd; } - } else { - panic!("RNDR failure :(((") + } + unsafe { + A_REAL_RANDOM_U64_I_PROMISE += 1; + A_REAL_RANDOM_U64_I_PROMISE } }