summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Mintram <me@jamesrm.com>2022-04-02 23:47:47 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2022-04-02 19:34:20 -0700
commit783a44b18ed837ac1aa8891acc47cf06d629817f (patch)
tree83ecf37df0c4b1416d44ffa639789d8db699fb0e
parent0d7eee625f9251a80b74b485a201e7d26144649f (diff)
downloadserenity-783a44b18ed837ac1aa8891acc47cf06d629817f.zip
Kernel: Make PhysicalRegion.cpp compile on aarch64
-rw-r--r--Kernel/Arch/aarch64/Processor.h2
-rw-r--r--Kernel/Arch/x86/Processor.h5
-rw-r--r--Kernel/Random.h3
3 files changed, 9 insertions, 1 deletions
diff --git a/Kernel/Arch/aarch64/Processor.h b/Kernel/Arch/aarch64/Processor.h
index 4ea7d65862..512c13da45 100644
--- a/Kernel/Arch/aarch64/Processor.h
+++ b/Kernel/Arch/aarch64/Processor.h
@@ -63,6 +63,8 @@ public:
return 0;
}
+ ALWAYS_INLINE static u64 read_cpu_counter() { return 0; }
+
ALWAYS_INLINE static void enter_critical() { }
ALWAYS_INLINE static void leave_critical() { }
ALWAYS_INLINE static u32 in_critical()
diff --git a/Kernel/Arch/x86/Processor.h b/Kernel/Arch/x86/Processor.h
index d7df2b257b..cd93b2bf37 100644
--- a/Kernel/Arch/x86/Processor.h
+++ b/Kernel/Arch/x86/Processor.h
@@ -158,6 +158,11 @@ public:
return *g_total_processors.ptr();
}
+ ALWAYS_INLINE static u64 read_cpu_counter()
+ {
+ return read_tsc();
+ }
+
ALWAYS_INLINE static void pause()
{
asm volatile("pause");
diff --git a/Kernel/Random.h b/Kernel/Random.h
index 8aaf0eaaf7..0213b83c9d 100644
--- a/Kernel/Random.h
+++ b/Kernel/Random.h
@@ -10,6 +10,7 @@
#include <AK/Assertions.h>
#include <AK/ByteBuffer.h>
#include <AK/Types.h>
+#include <Kernel/Arch/Processor.h>
#include <Kernel/Locking/Mutex.h>
#include <Kernel/StdLib.h>
#include <LibCrypto/Cipher/AES.h>
@@ -163,7 +164,7 @@ public:
auto& kernel_rng = KernelRng::the();
SpinlockLocker lock(kernel_rng.get_lock());
// We don't lock this because on the off chance a pool is corrupted, entropy isn't lost.
- Event<T> event = { read_tsc(), m_source, event_data };
+ Event<T> event = { Processor::read_cpu_counter(), m_source, event_data };
kernel_rng.add_random_event(event, m_pool);
m_pool++;
kernel_rng.wake_if_ready();