summaryrefslogtreecommitdiff
path: root/Kernel/Random.cpp
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-09-23 11:41:59 +0300
committerLinus Groh <mail@linusgroh.de>2022-09-23 17:22:15 +0100
commitfe2bd8e3ddcc833c39f0a7a8b52b6c2345a691a8 (patch)
tree05176282665f699345864843a14fa359bae33667 /Kernel/Random.cpp
parent48f3d762af8694af376dd88264ce7ff38ecd3d41 (diff)
downloadserenity-fe2bd8e3ddcc833c39f0a7a8b52b6c2345a691a8.zip
Kernel: Move x86-specific timer code handling to Arch/x86/Time directory
The APICTimer, HPET and RTC (the RTC timer is in the context of the PC RTC here) are timers that exist only in x86 platforms, therefore, we move the handling code and the initialization code to the Arch/x86/Time directory. Other related code patterns in the TimeManagement singleton and in the Random.cpp file are guarded with #ifdef to ensure they are only compiled for x86 builds.
Diffstat (limited to 'Kernel/Random.cpp')
-rw-r--r--Kernel/Random.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/Kernel/Random.cpp b/Kernel/Random.cpp
index 6d87ddfa8f..dd6dc742ea 100644
--- a/Kernel/Random.cpp
+++ b/Kernel/Random.cpp
@@ -7,11 +7,13 @@
#include <AK/Singleton.h>
#include <Kernel/Arch/Processor.h>
+#if ARCH(I386) || ARCH(X86_64)
+# include <Kernel/Arch/x86/Time/HPET.h>
+# include <Kernel/Arch/x86/Time/RTC.h>
+#endif
#include <Kernel/Devices/RandomDevice.h>
#include <Kernel/Random.h>
#include <Kernel/Sections.h>
-#include <Kernel/Time/HPET.h>
-#include <Kernel/Time/RTC.h>
#include <Kernel/Time/TimeManagement.h>
namespace Kernel {
@@ -48,7 +50,9 @@ UNMAP_AFTER_INIT KernelRng::KernelRng()
add_random_event(value, i % 32);
}
- } else if (TimeManagement::the().can_query_precise_time()) {
+ }
+#if ARCH(I386) || ARCH(X86_64)
+ else if (TimeManagement::the().can_query_precise_time()) {
// Add HPET as entropy source if we don't have anything better.
dmesgln("KernelRng: Using HPET as entropy source");
@@ -66,6 +70,7 @@ UNMAP_AFTER_INIT KernelRng::KernelRng()
current_time += 0x40b2u;
}
}
+#endif
}
void KernelRng::wait_for_entropy()