Kernel/aarch64: Stub enough functions to build Random.cpp

Also update Random.cpp such that it builds for aarch64.
This commit is contained in:
Timon Kruiper 2022-10-20 13:17:25 +02:00 committed by Gunnar Beutner
parent a998bba73b
commit cede752cd1
Notes: sideshowbarker 2024-07-17 05:15:45 +09:00
3 changed files with 23 additions and 15 deletions

View file

@ -17,7 +17,6 @@
#include <Kernel/PhysicalAddress.h>
#include <Kernel/Process.h>
#include <Kernel/ProcessExposed.h>
#include <Kernel/Random.h>
#include <Kernel/Scheduler.h>
#include <Kernel/Sections.h>
#include <Kernel/TTY/TTY.h>
@ -25,16 +24,6 @@
#include <Kernel/TimerQueue.h>
#include <Kernel/UserOrKernelBuffer.h>
// Random
namespace Kernel {
void get_fast_random_bytes(Bytes)
{
TODO_AARCH64();
}
}
// Process
char const* asm_signal_trampoline = nullptr;
char const* asm_signal_trampoline_end = nullptr;
@ -337,6 +326,22 @@ bool Thread::WaitQueueBlocker::unblock()
TODO_AARCH64();
}
Thread::WaitQueueBlocker::WaitQueueBlocker(WaitQueue& wait_queue, StringView)
: m_wait_queue(wait_queue)
{
TODO_AARCH64();
}
bool Thread::WaitQueueBlocker::setup_blocker()
{
TODO_AARCH64();
}
Thread::WaitQueueBlocker::~WaitQueueBlocker()
{
TODO_AARCH64();
}
void Thread::WaitBlockerSet::finalize()
{
TODO_AARCH64();

View file

@ -474,6 +474,7 @@ else()
set(SOURCES
${AK_SOURCES}
${RPI_SOURCES}
${CRYPTO_SOURCES}
Arch/Processor.cpp
@ -506,6 +507,7 @@ else()
MiniStdLib.cpp
Process.cpp
ProcessProcFSTraits.cpp
Random.cpp
Scheduler.cpp
StdLib.cpp
Time/TimeManagement.cpp

View file

@ -28,6 +28,7 @@ KernelRng& KernelRng::the()
UNMAP_AFTER_INIT KernelRng::KernelRng()
{
#if ARCH(I386) || ARCH(X86_64)
bool supports_rdseed = Processor::current().has_feature(CPUFeature::RDSEED);
bool supports_rdrand = Processor::current().has_feature(CPUFeature::RDRAND);
if (supports_rdseed || supports_rdrand) {
@ -50,9 +51,7 @@ UNMAP_AFTER_INIT KernelRng::KernelRng()
add_random_event(value, i % 32);
}
}
#if ARCH(I386) || ARCH(X86_64)
else if (TimeManagement::the().can_query_precise_time()) {
} 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");
@ -70,6 +69,8 @@ UNMAP_AFTER_INIT KernelRng::KernelRng()
current_time += 0x40b2u;
}
}
#else
dmesgln("KernelRng: No entropy source available!");
#endif
}
@ -121,7 +122,7 @@ bool get_good_random_bytes(Bytes buffer, bool allow_wait, bool fallback_to_fast)
bool result = false;
auto& kernel_rng = KernelRng::the();
// FIXME: What if interrupts are disabled because we're in an interrupt?
bool can_wait = are_interrupts_enabled();
bool can_wait = Processor::are_interrupts_enabled();
if (!can_wait && allow_wait) {
// If we can't wait but the caller would be ok with it, then we
// need to definitely fallback to *something*, even if it's less