/* ------------------------------------------- Copyright Mahrouss Logic ------------------------------------------- */ #pragma once #include #include #include #ifdef __x86_64__ #include #include #include #elif defined(__powerpc64__) #include #else #error Unknown architecture #endif 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 kKernelMaxSystemCalls (256) typedef HCore::Void (*rt_syscall_proc)(HCore::HAL::StackFramePtr); extern HCore::Array kSyscalls; EXTERN_C HCore::Void rt_wait_400ns(); EXTERN_C HCore::Void ATTRIBUTE(interrupt) rt_syscall_handle(HCore::HAL::StackFramePtr stackFrame); EXTERN_C HCore::HAL::StackFramePtr rt_get_current_context(); EXTERN_C HCore::Void rt_do_context_switch(HCore::HAL::StackFramePtr stackFrame); inline HCore::VoidPtr kKernelVirtualStart; inline HCore::UIntPtr kKernelVirtualSize; inline HCore::VoidPtr kKernelPhysicalStart; inline HCore::UIntPtr kKernelPhysicalSize; #include inline HCore::HEL::HandoverInformationHeader* kHandoverHeader;