From af8a516fc22865abd80d6e26f1541fa3d6bebfdc Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 9 May 2024 00:42:44 +0200 Subject: MHR-23: :boom:, refactors. - Move NewBoot to /Boot, thus making Kernel directory only containing the kernel. Signed-off-by: Amlal El Mahrouss --- Kernel/ArchKit/ArchKit.hpp | 50 ++++++++++++++++++++++++++++++++++++++++ Kernel/ArchKit/compile_flags.txt | 7 ++++++ 2 files changed, 57 insertions(+) create mode 100644 Kernel/ArchKit/ArchKit.hpp create mode 100644 Kernel/ArchKit/compile_flags.txt (limited to 'Kernel/ArchKit') diff --git a/Kernel/ArchKit/ArchKit.hpp b/Kernel/ArchKit/ArchKit.hpp new file mode 100644 index 00000000..a341035b --- /dev/null +++ b/Kernel/ArchKit/ArchKit.hpp @@ -0,0 +1,50 @@ +/* ------------------------------------------- + + Copyright SoftwareLabs + +------------------------------------------- */ + +#pragma once + +#include +#include +#include + +#ifdef __NEWOS_AMD64__ +#include +#include +#include +#elif defined(__NEWOS_PPC__) +#include +#else +#error Unknown architecture +#endif + +namespace NewOS +{ + constexpr static inline SSizeT rt_hash_seed(const char* seed, int mul) + { + SSizeT hash = 0; + + for (SSizeT idx = 0; seed[idx] != 0; ++idx) + { + hash += seed[idx]; + hash ^= mul; + } + + return hash; + } +} // namespace NewOS + +#define kKernelMaxSystemCalls (256) + +typedef NewOS::Void (*rt_syscall_proc)(NewOS::HAL::StackFramePtr); + +extern NewOS::Array + kSyscalls; + +EXTERN_C NewOS::HAL::StackFramePtr rt_get_current_context(); +EXTERN_C NewOS::Void rt_do_context_switch(NewOS::HAL::StackFramePtr stackFrame); + +#include diff --git a/Kernel/ArchKit/compile_flags.txt b/Kernel/ArchKit/compile_flags.txt new file mode 100644 index 00000000..a3cab89d --- /dev/null +++ b/Kernel/ArchKit/compile_flags.txt @@ -0,0 +1,7 @@ +-nostdlib +-ffreestanding +-std=c++20 +-I./ +-I../ +-I$(HOME)/ +-D__NEWOS_AMD64__ -- cgit v1.2.3