mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:38:12 +00:00
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.
This commit is contained in:
parent
48f3d762af
commit
fe2bd8e3dd
16 changed files with 51 additions and 33 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue