From e2bbec91d70847cc5a2ff67eb84ca4a3c2d03e85 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 4 Feb 2024 10:59:24 +0100 Subject: Kernel: Depend less on NewFS, add support for FileSystem protocol in NewBoot. Signed-off-by: Amlal El Mahrouss --- Private/ArchKit/ArchKit.hpp | 106 +++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 61 deletions(-) (limited to 'Private/ArchKit/ArchKit.hpp') diff --git a/Private/ArchKit/ArchKit.hpp b/Private/ArchKit/ArchKit.hpp index eefd6f5f..1b3d7884 100644 --- a/Private/ArchKit/ArchKit.hpp +++ b/Private/ArchKit/ArchKit.hpp @@ -9,80 +9,64 @@ #pragma once +#include #include #include -#include #ifdef __x86_64__ -# include -# include -# include +#include +#include +#include #elif defined(__powerpc64__) -# include +#include #else -# error Unknown architecture +#error Unknown architecture #endif -namespace HCore -{ - class SystemCallDefaultImpl final - { - public: - static Int32 Exec() { return 0; } - - }; - - template - class SystemCall - { - public: - explicit SystemCall() - { - kcout << "SystemCall::SystemCall"; - } - - virtual ~SystemCall() - { - kcout << "SystemCall::~SystemCall"; - } - - SystemCall &operator=(const SystemCall &) = default; - SystemCall(const SystemCall &) = default; - - // Should not be called alone! - virtual bool Exec() const - { - kcout << "SystemCall->Exec()"; - return false; - } - - }; - - constexpr static inline SSizeT syscall_hash(const char *seed, int mul) - { - SSizeT hash = 0; - - for (SSizeT idx = 0; seed[idx] != 0; ++idx) - { - hash += seed[idx]; - hash ^= mul; - } - - return hash; - } - - bool ke_init_hal(); -} // namespace HCore +namespace HCore { +template +class SystemCall { + public: + explicit SystemCall() { kcout << "SystemCall::SystemCall"; } + + virtual ~SystemCall() { kcout << "SystemCall::~SystemCall"; } + + SystemCall &operator=(const SystemCall &) = default; + SystemCall(const SystemCall &) = default; + + // Should not be called alone! + virtual bool Exec() const { + kcout << "SystemCall->Exec()"; + return false; + } +}; + +constexpr static inline SSizeT syscall_hash(const char *seed, int mul) { + SSizeT hash = 0; + + for (SSizeT idx = 0; seed[idx] != 0; ++idx) { + hash += seed[idx]; + hash ^= mul; + } + + return hash; +} + +bool ke_init_hal(); +} // namespace HCore #define kMaxSyscalls 0x100 #define kSyscallGate 0x21 -extern HCore::Array kSyscalls; +extern HCore::Array + kSyscalls; -extern "C" void rt_wait_for_io(); -extern "C" void rt_syscall_handle(HCore::HAL::StackFrame* stackFrame); -extern "C" HCore::HAL::StackFrame* rt_get_current_context(); -extern "C" int rt_do_context_switch(HCore::HAL::StackFrame* stackFrame); +extern "C" HCore::Void rt_wait_for_io(); +extern "C" HCore::Void rt_syscall_handle(HCore::HAL::StackFramePtr stackFrame); +extern "C" HCore::HAL::StackFramePtr rt_get_current_context(); +extern "C" HCore::Int32 rt_do_context_switch( + HCore::HAL::StackFramePtr stackFrame); inline HCore::VoidPtr kKernelVirtualStart; inline HCore::UIntPtr kKernelVirtualSize; -- cgit v1.2.3