From d7112cd6909640afd7609b3a142bc6ecf921ee25 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 30 Jan 2024 08:46:09 +0100 Subject: Kernel: Breaking changes, see source code. Signed-off-by: Amlal El Mahrouss --- Private/ArchKit/Arch.hpp | 14 +- Private/ArchKit/SyscallImpl.hpp | 2 +- Private/CFKit/GUIDWizard.hpp | 8 +- Private/CFKit/GUIDWrapper.hpp | 6 +- Private/CFKit/Property.hpp | 6 +- Private/CFKit/URL.hpp | 6 +- Private/CRT/__cxxkit_alloca.h | 15 -- Private/CRT/__cxxkit_alloca.hxx | 15 ++ Private/CRT/__cxxkit_defines.h | 91 ---------- Private/CRT/__cxxkit_defines.hxx | 91 ++++++++++ Private/CompilerKit/Compiler.hpp | 36 ---- Private/CompilerKit/CompilerKit.hpp | 36 ++++ Private/EFIKit/EFI.hxx | 2 +- Private/FSKit/Defines.hpp | 2 +- Private/FSKit/IndexableProperty.hxx | 4 +- Private/FSKit/NewFS.hxx | 86 +++++----- Private/FSKit/NewFSIndexer.hxx | 6 +- Private/HALKit/AMD64/ACPI/ACPI.hpp | 6 +- Private/HALKit/AMD64/ACPI/ACPIManager.hpp | 6 +- Private/HALKit/AMD64/ACPIManagerAMD64.cpp | 8 +- Private/HALKit/AMD64/CoreInterruptHandlerAMD64.cpp | 70 ++++---- Private/HALKit/AMD64/CoreMultiProcessingAMD64.cpp | 6 +- Private/HALKit/AMD64/CoreSyscallHandlerAMD64.cpp | 8 +- Private/HALKit/AMD64/DebugManager.asm | 4 +- Private/HALKit/AMD64/DebugOutput.cxx | 10 +- Private/HALKit/AMD64/DebugPort.cxx | 6 +- Private/HALKit/AMD64/HalPageAlloc.cpp | 12 +- Private/HALKit/AMD64/HalPageAlloc.hpp | 24 +-- Private/HALKit/AMD64/HardwareAPIC.cpp | 6 +- Private/HALKit/AMD64/HardwareInit.cpp | 6 +- Private/HALKit/AMD64/Hypervisor.hpp | 6 +- Private/HALKit/AMD64/InstallTIB.asm | 2 +- Private/HALKit/AMD64/PCI/Database.cpp | 4 +- Private/HALKit/AMD64/PCI/Device.cpp | 28 ++-- Private/HALKit/AMD64/PCI/Dma.cpp | 6 +- Private/HALKit/AMD64/PCI/Express.cpp | 4 +- Private/HALKit/AMD64/PCI/IO.cpp | 2 +- Private/HALKit/AMD64/PCI/Iterator.cpp | 6 +- Private/HALKit/AMD64/PCI/PCI.cpp | 2 +- Private/HALKit/AMD64/PlatformAMD64.cpp | 6 +- Private/HALKit/AMD64/ProcessPrimitives.cxx | 4 +- Private/HALKit/AMD64/Processor.cpp | 6 +- Private/HALKit/AMD64/Processor.hpp | 22 +-- Private/HALKit/AMD64/SMPCoreManager.asm | 2 +- Private/HALKit/AMD64/StartSequence.asm | 2 +- Private/HALKit/Alpha/CoreSyscallHandlerDEC.cpp | 8 +- Private/HALKit/Alpha/Processor.hpp | 2 +- Private/HALKit/PowerPC/CoreContextSwitchPowerPC.s | 2 +- .../HALKit/PowerPC/CoreSyscallHandlerPowerPC.cpp | 8 +- Private/HALKit/PowerPC/Processor.cpp | 10 +- Private/HALKit/PowerPC/Processor.hpp | 10 +- Private/KernelKit/CodeManager.hpp | 77 +++++---- Private/KernelKit/DebugOutput.hpp | 6 +- Private/KernelKit/Defines.hpp | 2 +- Private/KernelKit/Device.hpp | 8 +- Private/KernelKit/DriveManager.hpp | 8 +- Private/KernelKit/FileManager.hpp | 8 +- Private/KernelKit/Framebuffer.hpp | 6 +- Private/KernelKit/Loader.hpp | 6 +- Private/KernelKit/OSErr.hpp | 4 +- Private/KernelKit/PCI/Database.hpp | 6 +- Private/KernelKit/PCI/Device.hpp | 10 +- Private/KernelKit/PCI/Dma.hpp | 6 +- Private/KernelKit/PCI/Dma.inl | 4 +- Private/KernelKit/PCI/Express.hpp | 2 +- Private/KernelKit/PCI/IO.hpp | 6 +- Private/KernelKit/PCI/Iterator.hpp | 4 +- Private/KernelKit/PCI/PCI.hpp | 6 +- Private/KernelKit/PEF.hpp | 10 +- Private/KernelKit/PermissionSelector.hxx | 6 +- Private/KernelKit/ProcessManager.hpp | 8 +- Private/KernelKit/SMPManager.hpp | 8 +- Private/KernelKit/Semaphore.hpp | 6 +- Private/KernelKit/SharedObjectCore.hxx | 6 +- Private/KernelKit/ThreadLocalStorage.hxx | 14 +- Private/KernelKit/ThreadLocalStorage.inl | 8 +- Private/KernelKit/Timer.hpp | 8 +- Private/Linker/16x0.json | 2 +- Private/Linker/32x0.json | 2 +- Private/Linker/64x0.json | 2 +- Private/Linker/Platforms/PC.lds | 2 +- Private/NetworkKit/IP.hpp | 6 +- Private/NetworkKit/NetworkDevice.hpp | 6 +- Private/NewBoot/BootKit/Boot.hxx | 6 +- Private/NewBoot/BootKit/Protocol.hxx | 4 +- Private/NewBoot/Source/HEL/AMD64/Boot.cxx | 8 +- Private/NewKit/Array.hpp | 6 +- Private/NewKit/ArrayList.hpp | 6 +- Private/NewKit/Atom.hpp | 6 +- Private/NewKit/CRC32.hpp | 6 +- Private/NewKit/CxxAbi.hpp | 2 +- Private/NewKit/Defines.hpp | 16 +- Private/NewKit/ErrorID.hpp | 2 +- Private/NewKit/ErrorOr.hpp | 6 +- Private/NewKit/Function.hpp | 4 +- Private/NewKit/Json.hpp | 10 +- Private/NewKit/KernelHeap.hpp | 6 +- Private/NewKit/LockDelegate.hpp | 6 +- Private/NewKit/Macros.hpp | 4 +- Private/NewKit/MutableArray.hpp | 12 +- Private/NewKit/New.hpp | 2 +- Private/NewKit/NewKit.hpp | 4 +- Private/NewKit/OwnPtr.hpp | 8 +- Private/NewKit/PageAllocator.hpp | 6 +- Private/NewKit/PageManager.hpp | 6 +- Private/NewKit/Pair.hpp | 6 +- Private/NewKit/Panic.hpp | 66 -------- Private/NewKit/Pmm.hpp | 6 +- Private/NewKit/Ref.hpp | 8 +- Private/NewKit/RuntimeCheck.hpp | 66 ++++++++ Private/NewKit/Stream.hpp | 6 +- Private/NewKit/String.hpp | 8 +- Private/NewKit/UserHeap.hpp | 6 +- Private/NewKit/Utils.hpp | 6 +- Private/NewKit/Variant.hpp | 6 +- Private/Source/Array.cxx | 2 +- Private/Source/ArrayList.cxx | 2 +- Private/Source/Atom.cxx | 2 +- Private/Source/CodeManager.cxx | 185 +++++++++------------ Private/Source/Crc32.cxx | 6 +- Private/Source/CxxAbi.cxx | 12 +- Private/Source/CxxKitRT.cxx | 4 +- Private/Source/Defines.cxx | 2 +- Private/Source/Device.cxx | 2 +- Private/Source/DriveManager.cxx | 6 +- Private/Source/ErrorOr.cxx | 2 +- Private/Source/FileManager.cxx | 8 +- Private/Source/Framebuffer.cxx | 10 +- Private/Source/GUIDWizard.cxx | 6 +- Private/Source/GUIDWrapper.cxx | 4 +- Private/Source/IndexableProperty.cxx | 10 +- Private/Source/Json.cxx | 6 +- Private/Source/KernelHeap.cxx | 6 +- Private/Source/LockDelegate.cxx | 2 +- Private/Source/MeBus/Database.cxx | 2 +- Private/Source/MutableArray.cxx | 2 +- Private/Source/Network/IP.cpp | 12 +- Private/Source/Network/NetworkDevice.cpp | 6 +- Private/Source/New+Delete.cxx | 12 +- Private/Source/NewFS-IO.cxx | 2 +- Private/Source/NewFS-Journal.cxx | 6 +- Private/Source/NewFS.cxx | 6 +- Private/Source/OSErr.cxx | 2 +- Private/Source/OwnPtr.cxx | 2 +- Private/Source/PRDT.cxx | 6 +- Private/Source/PageAllocator.cxx | 8 +- Private/Source/PageManager.cxx | 8 +- Private/Source/Panic.cxx | 49 ------ Private/Source/PermissionSelector.cxx | 8 +- Private/Source/Pmm.cxx | 6 +- Private/Source/ProcessManager.cxx | 12 +- Private/Source/Property.cxx | 6 +- Private/Source/Ref.cxx | 2 +- Private/Source/RuntimeCheck.cxx | 81 +++++++++ Private/Source/RuntimeMain.cxx | 14 +- Private/Source/SMPManager.cxx | 8 +- Private/Source/Semaphore.cxx | 6 +- Private/Source/SharedObjectEntry.cxx | 4 +- Private/Source/Storage/ATA.cxx | 6 +- Private/Source/Storage/NVME.cxx | 6 +- Private/Source/Storage/Storage.cxx | 2 +- Private/Source/Stream.cxx | 2 +- Private/Source/String.cxx | 6 +- Private/Source/ThreadLocalStorage.cxx | 6 +- Private/Source/Timer.cxx | 4 +- Private/Source/URL.cxx | 6 +- Private/Source/UserHeap.cxx | 6 +- Private/Source/Utils.cxx | 10 +- Private/Source/Variant.cxx | 6 +- Private/StorageKit/ATA.hpp | 6 +- Private/StorageKit/NVME.hpp | 6 +- Private/StorageKit/PRDT.hpp | 8 +- Private/StorageKit/Storage.hpp | 4 +- Private/StorageKit/StorageCore.inl | 6 +- Private/compile_flags.txt | 4 + Private/makefile | 6 +- Public/SDK/SystemKit/FileAPI.hxx | 4 +- Public/SDK/SystemKit/HeapAPI.hxx | 6 +- Public/SDK/SystemKit/SystemKit.hxx | 2 +- Public/SDK/SystemKit/ThreadAPI.hxx | 14 +- Public/SDK/ZipKit/Defines.hpp | 2 +- Public/SDK/ZipKit/Zip.hpp | 2 +- Public/compile_flags.txt | 5 + SPECIFICATION.TXT | 1 + 184 files changed, 1010 insertions(+), 996 deletions(-) delete mode 100644 Private/CRT/__cxxkit_alloca.h create mode 100644 Private/CRT/__cxxkit_alloca.hxx delete mode 100644 Private/CRT/__cxxkit_defines.h create mode 100644 Private/CRT/__cxxkit_defines.hxx delete mode 100644 Private/CompilerKit/Compiler.hpp create mode 100644 Private/CompilerKit/CompilerKit.hpp delete mode 100644 Private/NewKit/Panic.hpp create mode 100644 Private/NewKit/RuntimeCheck.hpp delete mode 100644 Private/Source/Panic.cxx create mode 100644 Private/Source/RuntimeCheck.cxx create mode 100644 Private/compile_flags.txt create mode 100644 Public/compile_flags.txt diff --git a/Private/ArchKit/Arch.hpp b/Private/ArchKit/Arch.hpp index 75b5aada..4cfa5e0e 100644 --- a/Private/ArchKit/Arch.hpp +++ b/Private/ArchKit/Arch.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -23,7 +23,7 @@ # error Unknown architecture #endif -namespace hCore +namespace HCore { class SystemCallDefaultImpl final { @@ -72,15 +72,15 @@ namespace hCore } bool init_hal(); -} // namespace hCore +} // 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 *stack); -extern "C" hCore::HAL::StackFrame* rt_get_current_context(); -extern "C" int rt_do_context_switch(hCore::HAL::StackFrame* stackLeft, hCore::HAL::StackFrame* stackRight); +extern "C" void rt_syscall_handle(HCore::HAL::StackFrame *stack); +extern "C" HCore::HAL::StackFrame* rt_get_current_context(); +extern "C" int rt_do_context_switch(HCore::HAL::StackFrame* stackLeft, HCore::HAL::StackFrame* stackRight); diff --git a/Private/ArchKit/SyscallImpl.hpp b/Private/ArchKit/SyscallImpl.hpp index 4d8001fb..dcb4991e 100644 --- a/Private/ArchKit/SyscallImpl.hpp +++ b/Private/ArchKit/SyscallImpl.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/CFKit/GUIDWizard.hpp b/Private/CFKit/GUIDWizard.hpp index d8f3b05d..881505b0 100644 --- a/Private/CFKit/GUIDWizard.hpp +++ b/Private/CFKit/GUIDWizard.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -18,7 +18,7 @@ #include #include -namespace hCore::XRN::Version1 { +namespace HCore::XRN::Version1 { Ref make_sequence(const ArrayList& seq); -ErrorOr> try_guid_to_string(Ref& guid); -} // namespace hCore::XRN::Version1 +ErrorOr> try_guid_to_string(Ref& guid); +} // namespace HCore::XRN::Version1 diff --git a/Private/CFKit/GUIDWrapper.hpp b/Private/CFKit/GUIDWrapper.hpp index fffa7a63..ff7c4e9b 100644 --- a/Private/CFKit/GUIDWrapper.hpp +++ b/Private/CFKit/GUIDWrapper.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -18,7 +18,7 @@ #define NULL_GUID "XRN:{........-....-M...-N...-............}" // eXtensible Resource Information -namespace hCore::XRN { +namespace HCore::XRN { union GUIDSequence { alignas(8) UShort u8[16]; alignas(8) UShort u16[8]; @@ -50,4 +50,4 @@ class GUID final { private: GUIDSequence m_UUID; }; -} // namespace hCore::XRN +} // namespace HCore::XRN diff --git a/Private/CFKit/Property.hpp b/Private/CFKit/Property.hpp index 1d5b4ee6..39ab97c2 100644 --- a/Private/CFKit/Property.hpp +++ b/Private/CFKit/Property.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -15,7 +15,7 @@ #include #include -namespace hCore { +namespace HCore { using PropertyId = Int; class Property { @@ -38,6 +38,6 @@ class Property { template using PropertyArray = Array; -} // namespace hCore +} // namespace HCore #endif // !_INC_PLIST_HPP__ diff --git a/Private/CFKit/URL.hpp b/Private/CFKit/URL.hpp index f2e35bcd..e8bcb78a 100644 --- a/Private/CFKit/URL.hpp +++ b/Private/CFKit/URL.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -13,7 +13,7 @@ #include #include -namespace hCore { +namespace HCore { class Url final { public: explicit Url(StringView &strUrl); @@ -27,6 +27,6 @@ class Url final { Ref m_urlView; }; -} // namespace hCore +} // namespace HCore #endif /* ifndef _INC_URL_HPP__ */ diff --git a/Private/CRT/__cxxkit_alloca.h b/Private/CRT/__cxxkit_alloca.h deleted file mode 100644 index 283ce791..00000000 --- a/Private/CRT/__cxxkit_alloca.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * ======================================================== - * - * hCore - * Copyright 2024 Mahrouss Logic, all rights reserved. - * - * ======================================================== - */ - -#pragma once - -typedef void* ptr_type; -typedef __SIZE_TYPE__ size_type; - -inline void* __cxxkit_alloca_gcc(size_type sz) { return __builtin_alloca(sz); } diff --git a/Private/CRT/__cxxkit_alloca.hxx b/Private/CRT/__cxxkit_alloca.hxx new file mode 100644 index 00000000..b27cc070 --- /dev/null +++ b/Private/CRT/__cxxkit_alloca.hxx @@ -0,0 +1,15 @@ +/* + * ======================================================== + * + * HCore + * Copyright 2024 Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#pragma once + +typedef void* ptr_type; +typedef __SIZE_TYPE__ size_type; + +inline void* __cxxkit_alloca_gcc(size_type sz) { return __builtin_alloca(sz); } diff --git a/Private/CRT/__cxxkit_defines.h b/Private/CRT/__cxxkit_defines.h deleted file mode 100644 index b36e9ba0..00000000 --- a/Private/CRT/__cxxkit_defines.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * ======================================================== - * - * hCore - * Copyright 2024 Mahrouss Logic, all rights reserved. - * - * ======================================================== - */ - -#ifndef __CXKIT_DEF__ -#define __CXKIT_DEF__ - -typedef __SIZE_TYPE__ size_t; - -#ifdef __LP64__ -typedef long int ssize_t; -#else -typedef int ssize_t; -#endif // __LP64__ - -typedef size_t ptrdiff_t; -typedef size_t uintptr_t; -typedef void *voidptr_t; -typedef void *any_t; -typedef char *caddr_t; - -#ifndef NULL -#define NULL ((voidptr_t)0) -#endif // !null - -#ifdef __GNUC__ -#include -#define __cxxkit_alloca(sz) __cxxkit_alloca_gcc(sz) -#elif defined(__HISYS__) - -#define __alloca(SZ) __cxxkit_alloca(SZ) - -#define __deref(ptr) (*(PTR)) - -#define __libexport __lib(export) -#define __libimport __lib(import) - -#ifdef __cplusplus -#define __init_decl() \ - extern "C" \ - { -#define __fini_decl() \ - } \ - ; -#else -#define __init_decl() -#define __fini_decl() -#endif -#endif - -#if __has_builtin(__builtin_alloca) -#define alloca(sz) __builtin_alloca(sz) -#ifdef __alloca -#undef __alloca -#endif -#define __alloca alloca -#else -#warning alloca not detected -#endif - -typedef long long off_t; -typedef unsigned long long uoff_t; - -typedef union float_cast { - struct - { - unsigned int mantissa : 23; - unsigned int exponent : 8; - unsigned int sign : 1; - }; - - float f; -} __attribute__((packed)) float_cast_t; - -typedef union double_cast { - struct - { - unsigned long long int mantissa : 52; - unsigned int exponent : 11; - unsigned int sign : 1; - }; - - double f; -} __attribute__((packed)) double_cast_t; - -#endif /* __CXKIT_DEF__ */ diff --git a/Private/CRT/__cxxkit_defines.hxx b/Private/CRT/__cxxkit_defines.hxx new file mode 100644 index 00000000..fd95433b --- /dev/null +++ b/Private/CRT/__cxxkit_defines.hxx @@ -0,0 +1,91 @@ +/* + * ======================================================== + * + * HCore + * Copyright 2024 Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#ifndef __CXKIT_DEF__ +#define __CXKIT_DEF__ + +typedef __SIZE_TYPE__ size_t; + +#ifdef __LP64__ +typedef long int ssize_t; +#else +typedef int ssize_t; +#endif // __LP64__ + +typedef size_t ptrdiff_t; +typedef size_t uintptr_t; +typedef void *voidptr_t; +typedef void *any_t; +typedef char *caddr_t; + +#ifndef NULL +#define NULL ((voidptr_t)0) +#endif // !null + +#ifdef __GNUC__ +#include +#define __cxxkit_alloca(sz) __cxxkit_alloca_gcc(sz) +#elif defined(__HISYS__) + +#define __alloca(SZ) __cxxkit_alloca(SZ) + +#define __deref(ptr) (*(PTR)) + +#define __libexport __lib(export) +#define __libimport __lib(import) + +#ifdef __cplusplus +#define __init_decl() \ + extern "C" \ + { +#define __fini_decl() \ + } \ + ; +#else +#define __init_decl() +#define __fini_decl() +#endif +#endif + +#if __has_builtin(__builtin_alloca) +#define alloca(sz) __builtin_alloca(sz) +#ifdef __alloca +#undef __alloca +#endif +#define __alloca alloca +#else +#warning alloca not detected +#endif + +typedef long long off_t; +typedef unsigned long long uoff_t; + +typedef union float_cast { + struct + { + unsigned int mantissa : 23; + unsigned int exponent : 8; + unsigned int sign : 1; + }; + + float f; +} __attribute__((packed)) float_cast_t; + +typedef union double_cast { + struct + { + unsigned long long int mantissa : 52; + unsigned int exponent : 11; + unsigned int sign : 1; + }; + + double f; +} __attribute__((packed)) double_cast_t; + +#endif /* __CXKIT_DEF__ */ diff --git a/Private/CompilerKit/Compiler.hpp b/Private/CompilerKit/Compiler.hpp deleted file mode 100644 index 091e3bef..00000000 --- a/Private/CompilerKit/Compiler.hpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * ======================================================== - * - * hCore - * Copyright 2024 Mahrouss Logic, all rights reserved. - * - * ======================================================== - */ - -#ifndef _INC_CL_HPP -#define _INC_CL_HPP - -#include - -#define HCORE_COPY_DELETE(KLASS) \ - KLASS &operator=(const KLASS &) = delete; \ - KLASS(const KLASS &) = delete; - - -#define HCORE_COPY_DEFAULT(KLASS) \ - KLASS &operator=(const KLASS &) = default; \ - KLASS(const KLASS &) = default; - - -#define HCORE_MOVE_DELETE(KLASS) \ - KLASS &operator=(KLASS &&) = delete; \ - KLASS(KLASS &&) = delete; - - -#define HCORE_MOVE_DEFAULT(KLASS) \ - KLASS &operator=(KLASS &&) = default; \ - KLASS(KLASS &&) = default; - - - -#endif /* ifndef _INC_CL_HPP */ diff --git a/Private/CompilerKit/CompilerKit.hpp b/Private/CompilerKit/CompilerKit.hpp new file mode 100644 index 00000000..420faa90 --- /dev/null +++ b/Private/CompilerKit/CompilerKit.hpp @@ -0,0 +1,36 @@ +/* + * ======================================================== + * + * HCore + * Copyright 2024 Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#ifndef _INC_CL_HPP +#define _INC_CL_HPP + +#include + +#define HCORE_COPY_DELETE(KLASS) \ + KLASS &operator=(const KLASS &) = delete; \ + KLASS(const KLASS &) = delete; + + +#define HCORE_COPY_DEFAULT(KLASS) \ + KLASS &operator=(const KLASS &) = default; \ + KLASS(const KLASS &) = default; + + +#define HCORE_MOVE_DELETE(KLASS) \ + KLASS &operator=(KLASS &&) = delete; \ + KLASS(KLASS &&) = delete; + + +#define HCORE_MOVE_DEFAULT(KLASS) \ + KLASS &operator=(KLASS &&) = default; \ + KLASS(KLASS &&) = default; + + + +#endif /* ifndef _INC_CL_HPP */ diff --git a/Private/EFIKit/EFI.hxx b/Private/EFIKit/EFI.hxx index 763acab1..969b42b2 100644 --- a/Private/EFIKit/EFI.hxx +++ b/Private/EFIKit/EFI.hxx @@ -18,7 +18,7 @@ #include #include -using namespace hCore; +using namespace HCore; // Forwar decls diff --git a/Private/FSKit/Defines.hpp b/Private/FSKit/Defines.hpp index 2191cf25..72cb94a6 100644 --- a/Private/FSKit/Defines.hpp +++ b/Private/FSKit/Defines.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/FSKit/IndexableProperty.hxx b/Private/FSKit/IndexableProperty.hxx index 4ba68056..4bd3002d 100644 --- a/Private/FSKit/IndexableProperty.hxx +++ b/Private/FSKit/IndexableProperty.hxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -12,7 +12,7 @@ #include #include -namespace hCore +namespace HCore { namespace Indexer { diff --git a/Private/FSKit/NewFS.hxx b/Private/FSKit/NewFS.hxx index 0e935cd5..1d32e676 100644 --- a/Private/FSKit/NewFS.hxx +++ b/Private/FSKit/NewFS.hxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -10,7 +10,7 @@ #pragma once #include -#include +#include #include #define kInvalidFork -1 @@ -33,23 +33,23 @@ enum struct NewBootBlock { - hCore::Char Ident[kIdentLen]; + HCore::Char Ident[kIdentLen]; - hCore::Char Kernel[kNameLen]; - hCore::Char GUI[kNameLen]; + HCore::Char Kernel[kNameLen]; + HCore::Char GUI[kNameLen]; - hCore::Int64 NumParts; - hCore::Int64 FreeSectors; - hCore::Int64 SectorCount; - hCore::Int64 SectorSz; + HCore::Int64 NumParts; + HCore::Int64 FreeSectors; + HCore::Int64 SectorCount; + HCore::Int64 SectorSz; - hCore::Int64 DiskSize; - hCore::Int32 DiskKind; + HCore::Int64 DiskSize; + HCore::Int32 DiskKind; - hCore::Lba FirstPartBlock; - hCore::Lba LastPartBlock; + HCore::Lba FirstPartBlock; + HCore::Lba LastPartBlock; - hCore::Char Pad[kPadLen]; + HCore::Char Pad[kPadLen]; }; #define kFlagDeleted 0xF0 @@ -62,31 +62,31 @@ struct NewBootBlock struct NewCatalog { - hCore::Char Name[kNameLen]; + HCore::Char Name[kNameLen]; - hCore::Int32 Flags; - hCore::Int32 Kind; + HCore::Int32 Flags; + HCore::Int32 Kind; - hCore::Lba FirstFork; - hCore::Lba LastFork; + HCore::Lba FirstFork; + HCore::Lba LastFork; }; struct NewFork { - hCore::Int32 Flags; - hCore::Int32 Kind; + HCore::Int32 Flags; + HCore::Int32 Kind; - hCore::Int64 ID; + HCore::Int64 ID; - hCore::Int64 ResourceId; - hCore::Int32 ResourceKind; - hCore::Int32 ResourceFlags; + HCore::Int64 ResourceId; + HCore::Int32 ResourceKind; + HCore::Int32 ResourceFlags; - hCore::Lba DataOffset; - hCore::SizeT DataSize; + HCore::Lba DataOffset; + HCore::SizeT DataSize; - hCore::Lba NextSibling; - hCore::Lba PreviousSibling; + HCore::Lba NextSibling; + HCore::Lba PreviousSibling; }; #define kResourceTypeDialog 10 @@ -98,24 +98,24 @@ struct NewFork struct NewPartitionBlock { - hCore::Char PartitionName[kPartLen]; - hCore::Char JsonPath[kConfigLen]; + HCore::Char PartitionName[kPartLen]; + HCore::Char JsonPath[kConfigLen]; - hCore::Int32 Flags; - hCore::Int32 Kind; + HCore::Int32 Flags; + HCore::Int32 Kind; - hCore::Lba StartCatalog; - hCore::SizeT CatalogCount; + HCore::Lba StartCatalog; + HCore::SizeT CatalogCount; - hCore::SizeT DiskSize; + HCore::SizeT DiskSize; - hCore::SizeT FreeCatalog; - hCore::SizeT FreeSectors; + HCore::SizeT FreeCatalog; + HCore::SizeT FreeSectors; - hCore::SizeT SectorCount; - hCore::SizeT SectorSize; + HCore::SizeT SectorCount; + HCore::SizeT SectorSize; - hCore::Char Pad[kPadLen]; + HCore::Char Pad[kPadLen]; }; #define kCatalogKindFile 1 @@ -143,9 +143,9 @@ struct NewPartitionBlock #define kFilesystemEOF 0xFF11 #define kFilesystemBitWidth sizeof(UInt16) -#define kFilesystemLbaType hCore::Lba +#define kFilesystemLbaType HCore::Lba -namespace hCore +namespace HCore { /// /// \name NewFSImpl diff --git a/Private/FSKit/NewFSIndexer.hxx b/Private/FSKit/NewFSIndexer.hxx index 66a73db4..0c1f185a 100644 --- a/Private/FSKit/NewFSIndexer.hxx +++ b/Private/FSKit/NewFSIndexer.hxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -12,7 +12,7 @@ #include #include -namespace hCore { +namespace HCore { namespace Indexer { class INewFSIterator; @@ -51,4 +51,4 @@ class INewFSIterator { MutableArray fProps; }; } // namespace Indexer -} // namespace hCore +} // namespace HCore diff --git a/Private/HALKit/AMD64/ACPI/ACPI.hpp b/Private/HALKit/AMD64/ACPI/ACPI.hpp index aa408c6f..a9e9fa79 100644 --- a/Private/HALKit/AMD64/ACPI/ACPI.hpp +++ b/Private/HALKit/AMD64/ACPI/ACPI.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore Date Added: 13/02/2023 + * HCore Date Added: 13/02/2023 * Copyright Mahrouss Logic, all rights reserved. * * ======================================================== @@ -12,7 +12,7 @@ #include -namespace hCore { +namespace HCore { class SDT { public: Char Signature[4]; @@ -60,6 +60,6 @@ class Address { UInt8 Reserved; UIntPtr Address; }; -} // namespace hCore +} // namespace HCore #endif // !_INC_ACPI_MANAGER_H diff --git a/Private/HALKit/AMD64/ACPI/ACPIManager.hpp b/Private/HALKit/AMD64/ACPI/ACPIManager.hpp index da01f1c7..2eafe5ed 100644 --- a/Private/HALKit/AMD64/ACPI/ACPIManager.hpp +++ b/Private/HALKit/AMD64/ACPI/ACPIManager.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore Date Added: 20/02/2023 + * HCore Date Added: 20/02/2023 * Copyright Mahrouss Logic, all rights reserved. * * ======================================================== @@ -15,7 +15,7 @@ #include #include -namespace hCore { +namespace HCore { class ACPIManager { public: explicit ACPIManager(voidPtr rsdptr); @@ -44,6 +44,6 @@ class ACPIManager { SSizeT m_Entries; // number of entries, -1 tells that no invalid entries were // found. }; -} // namespace hCore +} // namespace HCore #endif // !_INC_ACPI_H diff --git a/Private/HALKit/AMD64/ACPIManagerAMD64.cpp b/Private/HALKit/AMD64/ACPIManagerAMD64.cpp index 0ca172a9..720ce0f2 100644 --- a/Private/HALKit/AMD64/ACPIManagerAMD64.cpp +++ b/Private/HALKit/AMD64/ACPIManagerAMD64.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,7 +11,7 @@ #include #include -namespace hCore { +namespace HCore { ACPIManager::ACPIManager(voidPtr rsdPtr) : m_Rsdp(rsdPtr), m_Entries(0) { RSDP *_rsdPtr = reinterpret_cast(this->m_Rsdp); @@ -37,7 +37,7 @@ ErrorOr ACPIManager::Find(const char *signature) { for (Size index = 0; index < num; ++index) { SDT *sdt = reinterpret_cast(xsdt + sizeof(SDT) + index * 8); - if (!Checksum(sdt->Signature, 4)) panic(RUNTIME_CHECK_ACPI); + if (!Checksum(sdt->Signature, 4)) ke_stop(RUNTIME_CHECK_ACPI); if (StringBuilder::Equals(const_cast(sdt->Signature), signature)) @@ -66,4 +66,4 @@ void rt_shutdown_acpi_qemu_30_plus(void) { HAL::out16(0x604, 0x2000); } void rt_shutdown_acpi_virtualbox(void) { HAL::out16(0x4004, 0x3400); } /// you'll have to parse the MADT otherwise! -} // namespace hCore +} // namespace HCore diff --git a/Private/HALKit/AMD64/CoreInterruptHandlerAMD64.cpp b/Private/HALKit/AMD64/CoreInterruptHandlerAMD64.cpp index 23262109..bed77b50 100644 --- a/Private/HALKit/AMD64/CoreInterruptHandlerAMD64.cpp +++ b/Private/HALKit/AMD64/CoreInterruptHandlerAMD64.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,71 +11,71 @@ #include #include -extern "C" void idt_handle_system_call(hCore::UIntPtr rsp) { - hCore::HAL::StackFrame *sf = reinterpret_cast(rsp); +extern "C" void idt_handle_system_call(HCore::UIntPtr rsp) { + HCore::HAL::StackFrame *sf = reinterpret_cast(rsp); rt_syscall_handle(sf); - hCore::kcout << "System Call with ID: " - << hCore::StringBuilder::FromInt("syscall{%}", sf->SID); + HCore::kcout << "System Call with ID: " + << HCore::StringBuilder::FromInt("syscall{%}", sf->SID); } -extern "C" void idt_handle_gpf(hCore::UIntPtr rsp) { - MUST_PASS(hCore::ProcessManager::Shared().Leak().GetCurrent()); +extern "C" void idt_handle_gpf(HCore::UIntPtr rsp) { + MUST_PASS(HCore::ProcessManager::Shared().Leak().GetCurrent()); - hCore::kcout << hCore::StringBuilder::FromInt("sp{%}", rsp); + HCore::kcout << HCore::StringBuilder::FromInt("sp{%}", rsp); - hCore::kcout + HCore::kcout << "General Protection Fault, Caused by " - << hCore::ProcessManager::Shared().Leak().GetCurrent().Leak().GetName(); + << HCore::ProcessManager::Shared().Leak().GetCurrent().Leak().GetName(); - hCore::ProcessManager::Shared().Leak().GetCurrent().Leak().Crash(); + HCore::ProcessManager::Shared().Leak().GetCurrent().Leak().Crash(); } -extern "C" void idt_handle_scheduler(hCore::UIntPtr rsp) { - hCore::kcout << hCore::StringBuilder::FromInt("sp{%}", rsp); +extern "C" void idt_handle_scheduler(HCore::UIntPtr rsp) { + HCore::kcout << HCore::StringBuilder::FromInt("sp{%}", rsp); - hCore::kcout + HCore::kcout << "Will be scheduled back later " - << hCore::ProcessManager::Shared().Leak().GetCurrent().Leak().GetName(); + << HCore::ProcessManager::Shared().Leak().GetCurrent().Leak().GetName(); /// schedule another process. - if (!hCore::ProcessHelper::StartScheduling()) { - hCore::kcout << "Let's continue schedule this process...\r\n"; + if (!HCore::ProcessHelper::StartScheduling()) { + HCore::kcout << "Let's continue schedule this process...\r\n"; } } -extern "C" void idt_handle_pf(hCore::UIntPtr rsp) { - hCore::kcout << hCore::StringBuilder::FromInt("sp{%}", rsp); +extern "C" void idt_handle_pf(HCore::UIntPtr rsp) { + HCore::kcout << HCore::StringBuilder::FromInt("sp{%}", rsp); - MUST_PASS(hCore::ProcessManager::Shared().Leak().GetCurrent()); + MUST_PASS(HCore::ProcessManager::Shared().Leak().GetCurrent()); - hCore::kcout + HCore::kcout << "Segmentation Fault, Caused by " - << hCore::ProcessManager::Shared().Leak().GetCurrent().Leak().GetName(); + << HCore::ProcessManager::Shared().Leak().GetCurrent().Leak().GetName(); - hCore::ProcessManager::Shared().Leak().GetCurrent().Leak().Crash(); + HCore::ProcessManager::Shared().Leak().GetCurrent().Leak().Crash(); } -extern "C" void idt_handle_math(hCore::UIntPtr rsp) { - hCore::kcout << hCore::StringBuilder::FromInt("sp{%}", rsp); +extern "C" void idt_handle_math(HCore::UIntPtr rsp) { + HCore::kcout << HCore::StringBuilder::FromInt("sp{%}", rsp); - MUST_PASS(hCore::ProcessManager::Shared().Leak().GetCurrent()); + MUST_PASS(HCore::ProcessManager::Shared().Leak().GetCurrent()); - hCore::kcout + HCore::kcout << "Math error, Caused by " - << hCore::ProcessManager::Shared().Leak().GetCurrent().Leak().GetName(); + << HCore::ProcessManager::Shared().Leak().GetCurrent().Leak().GetName(); - hCore::ProcessManager::Shared().Leak().GetCurrent().Leak().Crash(); + HCore::ProcessManager::Shared().Leak().GetCurrent().Leak().Crash(); } -extern "C" void idt_handle_generic(hCore::UIntPtr rsp) { - hCore::kcout << hCore::StringBuilder::FromInt("sp{%}", rsp); +extern "C" void idt_handle_generic(HCore::UIntPtr rsp) { + HCore::kcout << HCore::StringBuilder::FromInt("sp{%}", rsp); - MUST_PASS(hCore::ProcessManager::Shared().Leak().GetCurrent()); + MUST_PASS(HCore::ProcessManager::Shared().Leak().GetCurrent()); - hCore::kcout + HCore::kcout << "Processor error, Caused by " - << hCore::ProcessManager::Shared().Leak().GetCurrent().Leak().GetName(); + << HCore::ProcessManager::Shared().Leak().GetCurrent().Leak().GetName(); - hCore::ProcessManager::Shared().Leak().GetCurrent().Leak().Crash(); + HCore::ProcessManager::Shared().Leak().GetCurrent().Leak().Crash(); } diff --git a/Private/HALKit/AMD64/CoreMultiProcessingAMD64.cpp b/Private/HALKit/AMD64/CoreMultiProcessingAMD64.cpp index 330a90e6..e46805fb 100644 --- a/Private/HALKit/AMD64/CoreMultiProcessingAMD64.cpp +++ b/Private/HALKit/AMD64/CoreMultiProcessingAMD64.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -14,7 +14,7 @@ //! NOTE: fGSI stands 'Field Global System Interrupt' -namespace hCore::HAL { +namespace HCore::HAL { constexpr Int32 kThreadAPIC = 0; constexpr Int32 kThreadLAPIC = 1; constexpr Int32 kThreadIOAPIC = 2; @@ -122,6 +122,6 @@ void system_get_cores(voidPtr rsdPtr) { ++counter; } } -} // namespace hCore::HAL +} // namespace HCore::HAL /////////////////////////////////////////////////////////////////////////////////////// diff --git a/Private/HALKit/AMD64/CoreSyscallHandlerAMD64.cpp b/Private/HALKit/AMD64/CoreSyscallHandlerAMD64.cpp index ccd81b9a..314cba0e 100644 --- a/Private/HALKit/AMD64/CoreSyscallHandlerAMD64.cpp +++ b/Private/HALKit/AMD64/CoreSyscallHandlerAMD64.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,13 +11,13 @@ #include #include -hCore::Array +HCore::Array kSyscalls; // IDT System Call Handler. // NOTE: don't trust the user. -extern "C" void rt_syscall_handle(hCore::HAL::StackFrame *stack) { - for (hCore::SizeT index = 0UL; index < kMaxSyscalls; ++index) { +extern "C" void rt_syscall_handle(HCore::HAL::StackFrame *stack) { + for (HCore::SizeT index = 0UL; index < kMaxSyscalls; ++index) { (kSyscalls[index].Leak().Leak())(stack->SID, stack); } } diff --git a/Private/HALKit/AMD64/DebugManager.asm b/Private/HALKit/AMD64/DebugManager.asm index 96c7e2f3..f89be7f8 100644 --- a/Private/HALKit/AMD64/DebugManager.asm +++ b/Private/HALKit/AMD64/DebugManager.asm @@ -1,7 +1,7 @@ ;; /* ;; * ======================================================== ;; * -;; * hCore +;; * HCore ;; * Copyright 2024 Mahrouss Logic, all rights reserved. ;; * ;; * ======================================================== @@ -13,7 +13,7 @@ ;; //////////////////////////////////////////////////// ;; __rt_debug_record_table: - db "DebugMgr/hCore", 0xa, 0xd, 0 + db "DebugMgr/HCore", 0xa, 0xd, 0 ;; User Data goes there resb 64 __rt_debug_int_3: diff --git a/Private/HALKit/AMD64/DebugOutput.cxx b/Private/HALKit/AMD64/DebugOutput.cxx index 123ad4c6..1662b26b 100644 --- a/Private/HALKit/AMD64/DebugOutput.cxx +++ b/Private/HALKit/AMD64/DebugOutput.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,7 +11,7 @@ #include #include -namespace hCore { +namespace HCore { enum CommStatus { kStateReady = 0xCF, kStateTransmit = 0xFC, @@ -39,7 +39,7 @@ bool serial_init() { // Check if serial is faulty (i.e: not same byte as sent) if (HAL::in8(PORT) != 0xAE) { - panic(RUNTIME_CHECK_HANDSHAKE); + ke_stop(RUNTIME_CHECK_HANDSHAKE); } kReady = kStateReady; @@ -69,5 +69,5 @@ void system_io_print(const char *bytes) { Detail::kState = kStateReady; } -TerminalDevice kcout(hCore::system_io_print, nullptr); -} // namespace hCore +TerminalDevice kcout(HCore::system_io_print, nullptr); +} // namespace HCore diff --git a/Private/HALKit/AMD64/DebugPort.cxx b/Private/HALKit/AMD64/DebugPort.cxx index 764aab0a..5c44d48e 100644 --- a/Private/HALKit/AMD64/DebugPort.cxx +++ b/Private/HALKit/AMD64/DebugPort.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -28,7 +28,7 @@ // after that we have start of additional data. -namespace hCore { +namespace HCore { typedef Char rt_debug_type[255]; class DebuggerPorts final { @@ -56,4 +56,4 @@ void rt_debug_listen(DebuggerPorts* theHook) noexcept { if (HAL::in16(theHook->fPort[i] != kDebugUnboundPort)) theHook->fBoundCnt++; } } -} // namespace hCore +} // namespace HCore diff --git a/Private/HALKit/AMD64/HalPageAlloc.cpp b/Private/HALKit/AMD64/HalPageAlloc.cpp index 25757942..6c7bd69b 100644 --- a/Private/HALKit/AMD64/HalPageAlloc.cpp +++ b/Private/HALKit/AMD64/HalPageAlloc.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -9,14 +9,14 @@ #include #include -#include +#include // this files handles paging. -static hCore::UIntPtr kPagePtr = kPagePtrAddress; -static hCore::SizeT kPageCnt = 0UL; +static HCore::UIntPtr kPagePtr = kPagePtrAddress; +static HCore::SizeT kPageCnt = 0UL; -namespace hCore { +namespace HCore { namespace HAL { static auto hal_try_alloc_new_page(SizeT sz, Boolean rw, Boolean user) -> PageTable64 * { @@ -53,4 +53,4 @@ auto hal_create_page(Boolean rw, Boolean user) -> UIntPtr { return reinterpret_cast(new_pte); } } // namespace HAL -} // namespace hCore +} // namespace HCore diff --git a/Private/HALKit/AMD64/HalPageAlloc.hpp b/Private/HALKit/AMD64/HalPageAlloc.hpp index dc954153..be00bd3c 100644 --- a/Private/HALKit/AMD64/HalPageAlloc.hpp +++ b/Private/HALKit/AMD64/HalPageAlloc.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -21,15 +21,15 @@ #define kPagePtrAddress 0x0900000 -extern "C" void flush_tlb(hCore::UIntPtr VirtualAddr); -extern "C" void write_cr3(hCore::UIntPtr pde); -extern "C" void write_cr0(hCore::UIntPtr bit); +extern "C" void flush_tlb(HCore::UIntPtr VirtualAddr); +extern "C" void write_cr3(HCore::UIntPtr pde); +extern "C" void write_cr0(HCore::UIntPtr bit); -extern "C" hCore::UIntPtr read_cr0(); -extern "C" hCore::UIntPtr read_cr2(); -extern "C" hCore::UIntPtr read_cr3(); +extern "C" HCore::UIntPtr read_cr0(); +extern "C" HCore::UIntPtr read_cr2(); +extern "C" HCore::UIntPtr read_cr3(); -namespace hCore::HAL { +namespace HCore::HAL { struct PageTable64 { bool Present : 1; bool Rw : 1; @@ -37,13 +37,13 @@ struct PageTable64 { bool Wt : 1; bool Cache : 1; bool Accessed : 1; - hCore::Int32 Reserved : 6; - hCore::UIntPtr PhysicalAddress : 36; - hCore::Int32 Reserved1 : 15; + HCore::Int32 Reserved : 6; + HCore::UIntPtr PhysicalAddress : 36; + HCore::Int32 Reserved1 : 15; bool ExecDisable : 1; }; PageTable64 *hal_alloc_page(SizeT sz, Boolean rw, Boolean user); UIntPtr hal_create_page(Boolean rw, Boolean user); -} // namespace hCore::HAL +} // namespace HCore::HAL diff --git a/Private/HALKit/AMD64/HardwareAPIC.cpp b/Private/HALKit/AMD64/HardwareAPIC.cpp index 9a058eae..6d77a8b5 100644 --- a/Private/HALKit/AMD64/HardwareAPIC.cpp +++ b/Private/HALKit/AMD64/HardwareAPIC.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,7 +11,7 @@ // bugs = 0 -namespace hCore { +namespace HCore { // @brief wakes up thread. // wakes up thread from hang. void rt_wakeup_thread(HAL::StackFrame* stack) { @@ -39,4 +39,4 @@ void rt_hang_thread(HAL::StackFrame* stack) { __asm__ volatile("sti"); } -} // namespace hCore +} // namespace HCore diff --git a/Private/HALKit/AMD64/HardwareInit.cpp b/Private/HALKit/AMD64/HardwareInit.cpp index 7d769bfa..db84226b 100644 --- a/Private/HALKit/AMD64/HardwareInit.cpp +++ b/Private/HALKit/AMD64/HardwareInit.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,10 +11,10 @@ // bugs = 0 -namespace hCore { +namespace HCore { bool init_hal() { // TODO: Hardware Specific stuff. return true; } -} // namespace hCore +} // namespace HCore diff --git a/Private/HALKit/AMD64/Hypervisor.hpp b/Private/HALKit/AMD64/Hypervisor.hpp index c830ef00..1154baf3 100644 --- a/Private/HALKit/AMD64/Hypervisor.hpp +++ b/Private/HALKit/AMD64/Hypervisor.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,7 +11,7 @@ #include -namespace hCore { +namespace HCore { MAKE_STRING_ENUM(HYPERVISOR) ENUM_STRING(Qemu, "TCGTCGTCGTCG"); ENUM_STRING(KVM, " KVMKVMKVM "); @@ -25,4 +25,4 @@ ENUM_STRING(Bhyve, "bhyve bhyve "); ENUM_STRING(Qnx, " QNXQVMBSQG "); END_STRING_ENUM() -} // namespace hCore +} // namespace HCore diff --git a/Private/HALKit/AMD64/InstallTIB.asm b/Private/HALKit/AMD64/InstallTIB.asm index 6957e1a6..dd0fcd26 100644 --- a/Private/HALKit/AMD64/InstallTIB.asm +++ b/Private/HALKit/AMD64/InstallTIB.asm @@ -1,7 +1,7 @@ ;; /* ;; * ======================================================== ;; * -;; * hCore +;; * HCore ;; * Copyright 2024 Mahrouss Logic, all rights reserved. ;; * ;; * ======================================================== diff --git a/Private/HALKit/AMD64/PCI/Database.cpp b/Private/HALKit/AMD64/PCI/Database.cpp index daf4bc61..f7f8fabc 100644 --- a/Private/HALKit/AMD64/PCI/Database.cpp +++ b/Private/HALKit/AMD64/PCI/Database.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -9,4 +9,4 @@ #include -namespace hCore {} +namespace HCore {} diff --git a/Private/HALKit/AMD64/PCI/Device.cpp b/Private/HALKit/AMD64/PCI/Device.cpp index 597e936b..f3da65f7 100644 --- a/Private/HALKit/AMD64/PCI/Device.cpp +++ b/Private/HALKit/AMD64/PCI/Device.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -10,29 +10,29 @@ #include #include -hCore::UInt LumiaPCIReadRaw(hCore::UInt bar, hCore::UShort bus, - hCore::UShort dev, hCore::UShort fun) { - hCore::UInt target = 0x80000000 | ((hCore::UInt)bus << 16) | - ((hCore::UInt)dev << 11) | ((hCore::UInt)fun << 8) | +HCore::UInt LumiaPCIReadRaw(HCore::UInt bar, HCore::UShort bus, + HCore::UShort dev, HCore::UShort fun) { + HCore::UInt target = 0x80000000 | ((HCore::UInt)bus << 16) | + ((HCore::UInt)dev << 11) | ((HCore::UInt)fun << 8) | (bar & 0xFC); - hCore::HAL::out32((hCore::UShort)hCore::PCI::PciConfigKind::ConfigAddress, + HCore::HAL::out32((HCore::UShort)HCore::PCI::PciConfigKind::ConfigAddress, target); - return hCore::HAL::in32((hCore::UShort)hCore::PCI::PciConfigKind::ConfigData); + return HCore::HAL::in32((HCore::UShort)HCore::PCI::PciConfigKind::ConfigData); } -void LumiaPCISetCfgTarget(hCore::UInt bar, hCore::UShort bus, hCore::UShort dev, - hCore::UShort fun) { - hCore::UInt target = 0x80000000 | ((hCore::UInt)bus << 16) | - ((hCore::UInt)dev << 11) | ((hCore::UInt)fun << 8) | +void LumiaPCISetCfgTarget(HCore::UInt bar, HCore::UShort bus, HCore::UShort dev, + HCore::UShort fun) { + HCore::UInt target = 0x80000000 | ((HCore::UInt)bus << 16) | + ((HCore::UInt)dev << 11) | ((HCore::UInt)fun << 8) | (bar & ~3); - hCore::HAL::out32((hCore::UShort)hCore::PCI::PciConfigKind::ConfigAddress, + HCore::HAL::out32((HCore::UShort)HCore::PCI::PciConfigKind::ConfigAddress, target); } -namespace hCore::PCI { +namespace HCore::PCI { Device::Device(UShort bus, UShort device, UShort func, UShort bar) : m_Bus(bus), m_Device(device), m_Function(func), m_Bar(bar) {} @@ -109,4 +109,4 @@ UShort Device::Vendor() { } Device::operator bool() { return VendorId() != (UShort)PciConfigKind::Invalid; } -} // namespace hCore::PCI +} // namespace HCore::PCI diff --git a/Private/HALKit/AMD64/PCI/Dma.cpp b/Private/HALKit/AMD64/PCI/Dma.cpp index e52ef743..03394628 100644 --- a/Private/HALKit/AMD64/PCI/Dma.cpp +++ b/Private/HALKit/AMD64/PCI/Dma.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -9,7 +9,7 @@ #include -namespace hCore { +namespace HCore { DMAWrapper::operator bool() { return m_Address; } bool DMAWrapper::operator!() { return !m_Address; } @@ -63,4 +63,4 @@ DMAWrapper &DMAWrapper::operator=(voidPtr Ptr) { m_Address = Ptr; return *this; } -} // namespace hCore +} // namespace HCore diff --git a/Private/HALKit/AMD64/PCI/Express.cpp b/Private/HALKit/AMD64/PCI/Express.cpp index eaf886b7..4a7bf20c 100644 --- a/Private/HALKit/AMD64/PCI/Express.cpp +++ b/Private/HALKit/AMD64/PCI/Express.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -9,4 +9,4 @@ #include -namespace hCore {} +namespace HCore {} diff --git a/Private/HALKit/AMD64/PCI/IO.cpp b/Private/HALKit/AMD64/PCI/IO.cpp index fb3ffb27..0e168477 100644 --- a/Private/HALKit/AMD64/PCI/IO.cpp +++ b/Private/HALKit/AMD64/PCI/IO.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/HALKit/AMD64/PCI/Iterator.cpp b/Private/HALKit/AMD64/PCI/Iterator.cpp index 3d357901..35d0916a 100644 --- a/Private/HALKit/AMD64/PCI/Iterator.cpp +++ b/Private/HALKit/AMD64/PCI/Iterator.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -12,7 +12,7 @@ #define PCI_ITERATOR_FIND_AND_UNWRAP(DEV, SZ) \ if (DEV.Leak()) return DEV.Leak(); -namespace hCore::PCI { +namespace HCore::PCI { Iterator::Iterator(const Types::PciDeviceKind &type) { // probe devices. for (int bus = 0; bus < ME_BUS_COUNT; ++bus) { @@ -34,4 +34,4 @@ Ref Iterator::operator[](const Size &sz) { PCI_ITERATOR_FIND_AND_UNWRAP(m_Devices[sz], sz); return {}; } -} // namespace hCore::PCI +} // namespace HCore::PCI diff --git a/Private/HALKit/AMD64/PCI/PCI.cpp b/Private/HALKit/AMD64/PCI/PCI.cpp index 833bce22..ea239e6f 100644 --- a/Private/HALKit/AMD64/PCI/PCI.cpp +++ b/Private/HALKit/AMD64/PCI/PCI.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/HALKit/AMD64/PlatformAMD64.cpp b/Private/HALKit/AMD64/PlatformAMD64.cpp index 3005cc07..1c0d560d 100644 --- a/Private/HALKit/AMD64/PlatformAMD64.cpp +++ b/Private/HALKit/AMD64/PlatformAMD64.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -9,7 +9,7 @@ #include -namespace hCore::HAL { +namespace HCore::HAL { namespace Detail { struct RegisterAMD64 final { UIntPtr base; @@ -44,4 +44,4 @@ void IDTLoader::Load(Register64 &idt) { void GDTLoader::Load(Ref &gdt) { GDTLoader::Load(gdt.Leak()); } void IDTLoader::Load(Ref &idt) { IDTLoader::Load(idt.Leak()); } -} // namespace hCore::HAL +} // namespace HCore::HAL diff --git a/Private/HALKit/AMD64/ProcessPrimitives.cxx b/Private/HALKit/AMD64/ProcessPrimitives.cxx index 557eb7f0..8d0554f3 100644 --- a/Private/HALKit/AMD64/ProcessPrimitives.cxx +++ b/Private/HALKit/AMD64/ProcessPrimitives.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,7 +11,7 @@ #include "NewKit/Defines.hpp" -using namespace hCore; +using namespace HCore; Void Process::AssignStart(UIntPtr &imageStart) noexcept { if (imageStart == 0) this->Crash(); diff --git a/Private/HALKit/AMD64/Processor.cpp b/Private/HALKit/AMD64/Processor.cpp index 893f4a58..3d509f79 100644 --- a/Private/HALKit/AMD64/Processor.cpp +++ b/Private/HALKit/AMD64/Processor.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -14,7 +14,7 @@ * @brief This file is about processor specific functions (in/out...) */ -namespace hCore::HAL { +namespace HCore::HAL { void out8(UInt16 port, UInt8 value) { asm volatile("outb %%al, %1" : : "a"(value), "Nd"(port) : "memory"); } @@ -55,4 +55,4 @@ void rt_cli() { asm volatile("cli"); } void rt_sti() { asm volatile("sti"); } void rt_cld() { asm volatile("cld"); } -} // namespace hCore::HAL +} // namespace HCore::HAL diff --git a/Private/HALKit/AMD64/Processor.hpp b/Private/HALKit/AMD64/Processor.hpp index 82eed130..dc258bcc 100644 --- a/Private/HALKit/AMD64/Processor.hpp +++ b/Private/HALKit/AMD64/Processor.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -16,7 +16,7 @@ #define IsActiveLow(flag) (flag & 2) #define IsLevelTriggered(flag) (flag & 8) -namespace hCore::HAL { +namespace HCore::HAL { extern "C" UChar in8(UInt16 port); extern "C" UShort in16(UInt16 port); extern "C" UInt in32(UInt16 port); @@ -112,12 +112,12 @@ class IDTLoader final { }; void system_get_cores(voidPtr rsdPtr); -} // namespace hCore::HAL - -extern "C" void idt_handle_system_call(hCore::UIntPtr rsp); -extern "C" void idt_handle_generic(hCore::UIntPtr rsp); -extern "C" void load_idt(hCore::voidPtr ptr); -extern "C" void load_gdt(hCore::voidPtr ptr); -extern "C" void idt_handle_gpf(hCore::UIntPtr rsp); -extern "C" void idt_handle_math(hCore::UIntPtr rsp); -extern "C" void idt_handle_pf(hCore::UIntPtr rsp); +} // namespace HCore::HAL + +extern "C" void idt_handle_system_call(HCore::UIntPtr rsp); +extern "C" void idt_handle_generic(HCore::UIntPtr rsp); +extern "C" void load_idt(HCore::voidPtr ptr); +extern "C" void load_gdt(HCore::voidPtr ptr); +extern "C" void idt_handle_gpf(HCore::UIntPtr rsp); +extern "C" void idt_handle_math(HCore::UIntPtr rsp); +extern "C" void idt_handle_pf(HCore::UIntPtr rsp); diff --git a/Private/HALKit/AMD64/SMPCoreManager.asm b/Private/HALKit/AMD64/SMPCoreManager.asm index 40664a7e..575375ae 100644 --- a/Private/HALKit/AMD64/SMPCoreManager.asm +++ b/Private/HALKit/AMD64/SMPCoreManager.asm @@ -1,7 +1,7 @@ ;; /* ;; * ======================================================== ;; * -;; * hCore +;; * HCore ;; * Copyright 2024 Mahrouss Logic, all rights reserved. ;; * ;; * ======================================================== diff --git a/Private/HALKit/AMD64/StartSequence.asm b/Private/HALKit/AMD64/StartSequence.asm index efb90843..a6f0c3b5 100644 --- a/Private/HALKit/AMD64/StartSequence.asm +++ b/Private/HALKit/AMD64/StartSequence.asm @@ -1,7 +1,7 @@ ;; /* ;; * ======================================================== ;; * -;; * hCore +;; * HCore ;; * Copyright 2024 Mahrouss Logic, all rights reserved. ;; * ;; * ======================================================== diff --git a/Private/HALKit/Alpha/CoreSyscallHandlerDEC.cpp b/Private/HALKit/Alpha/CoreSyscallHandlerDEC.cpp index 3f8cf800..0881f9c6 100644 --- a/Private/HALKit/Alpha/CoreSyscallHandlerDEC.cpp +++ b/Private/HALKit/Alpha/CoreSyscallHandlerDEC.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -10,11 +10,11 @@ #include #include -hCore::Array kSyscalls; +HCore::Array kSyscalls; -extern "C" void rt_syscall_handle(hCore::HAL::StackFrame *stack) +extern "C" void rt_syscall_handle(HCore::HAL::StackFrame *stack) { - for (hCore::SizeT index = 0UL; index < kMaxSyscalls; ++index) + for (HCore::SizeT index = 0UL; index < kMaxSyscalls; ++index) { (kSyscalls[index].Leak().Leak())(stack->ID, stack); } diff --git a/Private/HALKit/Alpha/Processor.hpp b/Private/HALKit/Alpha/Processor.hpp index 7c744e19..e6a00db3 100644 --- a/Private/HALKit/Alpha/Processor.hpp +++ b/Private/HALKit/Alpha/Processor.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/HALKit/PowerPC/CoreContextSwitchPowerPC.s b/Private/HALKit/PowerPC/CoreContextSwitchPowerPC.s index a33ff931..04a0cbbf 100644 --- a/Private/HALKit/PowerPC/CoreContextSwitchPowerPC.s +++ b/Private/HALKit/PowerPC/CoreContextSwitchPowerPC.s @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/HALKit/PowerPC/CoreSyscallHandlerPowerPC.cpp b/Private/HALKit/PowerPC/CoreSyscallHandlerPowerPC.cpp index ee300501..6985f964 100644 --- a/Private/HALKit/PowerPC/CoreSyscallHandlerPowerPC.cpp +++ b/Private/HALKit/PowerPC/CoreSyscallHandlerPowerPC.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -10,11 +10,11 @@ #include #include -hCore::Array +HCore::Array kSyscalls; -extern "C" void rt_syscall_handle(hCore::HAL::StackFrame *stack) { - for (hCore::SizeT index = 0UL; index < kMaxSyscalls; ++index) { +extern "C" void rt_syscall_handle(HCore::HAL::StackFrame *stack) { + for (HCore::SizeT index = 0UL; index < kMaxSyscalls; ++index) { (kSyscalls[index].Leak().Leak())(stack->ID, stack); } } diff --git a/Private/HALKit/PowerPC/Processor.cpp b/Private/HALKit/PowerPC/Processor.cpp index e3b207c6..9ac0953e 100644 --- a/Private/HALKit/PowerPC/Processor.cpp +++ b/Private/HALKit/PowerPC/Processor.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -12,9 +12,9 @@ extern "C" void flush_tlb() {} extern "C" void rt_wait_for_io() {} -extern "C" hCore::HAL::StackFrame* rt_get_current_context() {} +extern "C" HCore::HAL::StackFrame* rt_get_current_context() {} -namespace hCore { +namespace HCore { namespace HAL { UIntPtr hal_create_page(bool rw, bool user) { return 0; } @@ -44,5 +44,5 @@ void system_io_print(const char* bytes) { } } -TerminalDevice kcout(hCore::system_io_print, nullptr); -} // namespace hCore +TerminalDevice kcout(HCore::system_io_print, nullptr); +} // namespace HCore diff --git a/Private/HALKit/PowerPC/Processor.hpp b/Private/HALKit/PowerPC/Processor.hpp index 5fc0dcb2..a29454c9 100644 --- a/Private/HALKit/PowerPC/Processor.hpp +++ b/Private/HALKit/PowerPC/Processor.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -14,7 +14,7 @@ #define __aligned __attribute__((aligned(4))) -namespace hCore::HAL { +namespace HCore::HAL { typedef UIntPtr Reg; struct __aligned StackFrame { @@ -37,8 +37,8 @@ inline void rt_halt() { } inline void rt_cli() {} -} // namespace hCore::HAL +} // namespace HCore::HAL -extern "C" void int_handle_math(hCore::UIntPtr sp); -extern "C" void int_handle_pf(hCore::UIntPtr sp); +extern "C" void int_handle_math(HCore::UIntPtr sp); +extern "C" void int_handle_pf(HCore::UIntPtr sp); extern "C" void* __ppc_alloca(size_t sz); diff --git a/Private/KernelKit/CodeManager.hpp b/Private/KernelKit/CodeManager.hpp index 66c8ca45..2a843755 100644 --- a/Private/KernelKit/CodeManager.hpp +++ b/Private/KernelKit/CodeManager.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -10,66 +10,63 @@ #ifndef _INC_CODE_MANAGER_ #define _INC_CODE_MANAGER_ -#include "NewKit/Defines.hpp" #include #include #include -namespace hCore -{ +#include "NewKit/Defines.hpp" + +namespace HCore { /// /// \name PEFLoader /// \brief PEF loader class. /// -class PEFLoader : public Loader -{ - private: - explicit PEFLoader() = delete; +class PEFLoader : public Loader { + private: + explicit PEFLoader() = delete; - public: - explicit PEFLoader(const VoidPtr blob); - explicit PEFLoader(const char *path); - ~PEFLoader() override; + public: + explicit PEFLoader(const VoidPtr blob); + explicit PEFLoader(const char *path); + ~PEFLoader() override; - public: - HCORE_COPY_DEFAULT(PEFLoader); + public: + HCORE_COPY_DEFAULT(PEFLoader); - public: - typedef void (*MainKind)(void); + public: + typedef void (*MainKind)(void); - public: - const char *Path() override; - const char *Format() override; - const char *MIME() override; + public: + const char *Path() override; + const char *Format() override; + const char *MIME() override; - public: - ErrorOr LoadStart() override; - VoidPtr FindSymbol(const char *name, Int32 kind) override; + public: + ErrorOr LoadStart() override; + VoidPtr FindSymbol(const char *name, Int32 kind) override; - public: - bool IsLoaded() noexcept; + public: + bool IsLoaded() noexcept; - private: - Ref fPath; - VoidPtr fCachedBlob; - bool fBad; + private: + Ref fPath; + VoidPtr fCachedBlob; + bool fBad; }; -namespace Utils -{ +namespace Utils { /// \brief Much like Mac OS's UPP. /// This is read-only by design. /// It handles different kind of code. -/// PowerPC <-> AMD64 for example. -typedef struct UniversalProcedureTable final -{ - const Char NAME[kPefNameLen]; - const VoidPtr TRAP; - const SizeT ARCH; +/// ARM <-> AMD64 for example. +typedef struct UniversalProcedureTable final { + const Char NAME[kPefNameLen]; + const VoidPtr TRAP; + const SizeT ARCH; } __attribute__((packed)) UniversalProcedureTableType; bool execute_from_image(PEFLoader &exec) noexcept; -} // namespace Utils -} // namespace hCore +} // namespace Utils +} // namespace HCore -#endif // ifndef _INC_CODE_MANAGER_ +#endif // ifndef _INC_CODE_MANAGER_ diff --git a/Private/KernelKit/DebugOutput.hpp b/Private/KernelKit/DebugOutput.hpp index 1e30e6a4..ac83ad16 100644 --- a/Private/KernelKit/DebugOutput.hpp +++ b/Private/KernelKit/DebugOutput.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -13,7 +13,7 @@ #include #include -namespace hCore +namespace HCore { // @brief Emulates a VT100 terminal. class TerminalDevice final : public DeviceInterface @@ -37,4 +37,4 @@ namespace hCore } extern TerminalDevice kcout; -} // namespace hCore +} // namespace HCore diff --git a/Private/KernelKit/Defines.hpp b/Private/KernelKit/Defines.hpp index d87d2b28..d7c3c092 100644 --- a/Private/KernelKit/Defines.hpp +++ b/Private/KernelKit/Defines.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/KernelKit/Device.hpp b/Private/KernelKit/Device.hpp index 4ae968c2..e172880b 100644 --- a/Private/KernelKit/Device.hpp +++ b/Private/KernelKit/Device.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -9,14 +9,14 @@ #pragma once -/* hCore */ +/* HCore */ /* File: KernelKit/Device.hpp */ /* Device abstraction utilities. */ #include #include -namespace hCore +namespace HCore { template class DeviceInterface; @@ -91,4 +91,4 @@ namespace hCore kDeviceCD, kDeviceSwap, }; -} // namespace hCore +} // namespace HCore diff --git a/Private/KernelKit/DriveManager.hpp b/Private/KernelKit/DriveManager.hpp index 251453aa..7bafb4dc 100644 --- a/Private/KernelKit/DriveManager.hpp +++ b/Private/KernelKit/DriveManager.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -9,7 +9,7 @@ #pragma once -#include +#include #include #include #include @@ -17,7 +17,7 @@ #define kDriveInvalidID -1 #define kDriveNameLen 32 -namespace hCore { +namespace HCore { enum { kInvalidDrive = -1, kBlockDevice = 0xAD, @@ -77,4 +77,4 @@ class DriveSelector final { private: DriveTraits *fDrive; }; -} // namespace hCore +} // namespace HCore diff --git a/Private/KernelKit/FileManager.hpp b/Private/KernelKit/FileManager.hpp index a1391c34..ef508393 100644 --- a/Private/KernelKit/FileManager.hpp +++ b/Private/KernelKit/FileManager.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -27,7 +27,7 @@ /// refer to first enum. #define kFileOpsCount 4 -namespace hCore +namespace HCore { enum { @@ -242,6 +242,6 @@ FileStream::FileStream(const Encoding *path) : fFile(Class::Get } template FileStream::~FileStream() = default; -} // namespace hCore +} // namespace HCore -#define node_cast(PTR) reinterpret_cast(PTR) +#define node_cast(PTR) reinterpret_cast(PTR) diff --git a/Private/KernelKit/Framebuffer.hpp b/Private/KernelKit/Framebuffer.hpp index b435202b..a0a0e4c5 100644 --- a/Private/KernelKit/Framebuffer.hpp +++ b/Private/KernelKit/Framebuffer.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -13,7 +13,7 @@ #include #include -namespace hCore +namespace HCore { enum class FramebufferColorKind : UChar { @@ -54,6 +54,6 @@ namespace hCore FramebufferColorKind m_Colour; }; -} // namespace hCore +} // namespace HCore #endif /* ifndef _INC_FB_HPP__ */ diff --git a/Private/KernelKit/Loader.hpp b/Private/KernelKit/Loader.hpp index e290abca..01f3fa48 100644 --- a/Private/KernelKit/Loader.hpp +++ b/Private/KernelKit/Loader.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,9 +11,9 @@ #include #include -#include +#include -namespace hCore +namespace HCore { class Loader { diff --git a/Private/KernelKit/OSErr.hpp b/Private/KernelKit/OSErr.hpp index 8872b3f0..a15e2e0a 100644 --- a/Private/KernelKit/OSErr.hpp +++ b/Private/KernelKit/OSErr.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,7 +11,7 @@ #include -namespace hCore +namespace HCore { typedef Int32 OSErr; diff --git a/Private/KernelKit/PCI/Database.hpp b/Private/KernelKit/PCI/Database.hpp index b62108a7..72198041 100644 --- a/Private/KernelKit/PCI/Database.hpp +++ b/Private/KernelKit/PCI/Database.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,7 +11,7 @@ #include #include -namespace hCore { +namespace HCore { namespace Types { // https://wiki.osdev.org/PCI enum class PciDeviceKind : UChar { @@ -35,4 +35,4 @@ namespace hCore { Invalid = Unassgined, }; } // namespace Types -} // namespace hCore +} // namespace HCore diff --git a/Private/KernelKit/PCI/Device.hpp b/Private/KernelKit/PCI/Device.hpp index 8e956563..d3c58e96 100644 --- a/Private/KernelKit/PCI/Device.hpp +++ b/Private/KernelKit/PCI/Device.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright Mahrouss Logic, all rights reserved. * * ======================================================== @@ -10,7 +10,7 @@ #include -namespace hCore::PCI +namespace HCore::PCI { enum class PciConfigKind : UShort { @@ -77,8 +77,8 @@ namespace hCore::PCI UShort m_Bar; }; -} // namespace hCore::PCI +} // namespace HCore::PCI -extern "C" void LumiaPCISetCfgTarget(hCore::UInt bar); -extern "C" hCore::UInt LumiaPCIReadRaw(hCore::UInt bar); +extern "C" void LumiaPCISetCfgTarget(HCore::UInt bar); +extern "C" HCore::UInt LumiaPCIReadRaw(HCore::UInt bar); diff --git a/Private/KernelKit/PCI/Dma.hpp b/Private/KernelKit/PCI/Dma.hpp index 87cd78cf..8e027179 100644 --- a/Private/KernelKit/PCI/Dma.hpp +++ b/Private/KernelKit/PCI/Dma.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright Mahrouss Logic, all rights reserved. * * ======================================================== @@ -15,7 +15,7 @@ #include #include -namespace hCore +namespace HCore { enum class DmaKind { @@ -76,6 +76,6 @@ class DMAFactory final public: static OwnPtr> Construct(OwnPtr &dma); }; -} // namespace hCore +} // namespace HCore #include diff --git a/Private/KernelKit/PCI/Dma.inl b/Private/KernelKit/PCI/Dma.inl index e1f27720..8738e54c 100644 --- a/Private/KernelKit/PCI/Dma.inl +++ b/Private/KernelKit/PCI/Dma.inl @@ -1,13 +1,13 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== */ -namespace hCore +namespace HCore { template T* DMAWrapper::operator->() diff --git a/Private/KernelKit/PCI/Express.hpp b/Private/KernelKit/PCI/Express.hpp index a3febed1..45676c23 100644 --- a/Private/KernelKit/PCI/Express.hpp +++ b/Private/KernelKit/PCI/Express.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/KernelKit/PCI/IO.hpp b/Private/KernelKit/PCI/IO.hpp index 9bb820be..bcc728f4 100644 --- a/Private/KernelKit/PCI/IO.hpp +++ b/Private/KernelKit/PCI/IO.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright Mahrouss Logic, all rights reserved. * * ======================================================== @@ -15,7 +15,7 @@ #include #include -namespace hCore +namespace HCore { template class IOArray final @@ -74,4 +74,4 @@ class IOArray final }; using IOArray16 = IOArray<16>; -} // namespace hCore +} // namespace HCore diff --git a/Private/KernelKit/PCI/Iterator.hpp b/Private/KernelKit/PCI/Iterator.hpp index 70fbe59a..89e1f246 100644 --- a/Private/KernelKit/PCI/Iterator.hpp +++ b/Private/KernelKit/PCI/Iterator.hpp @@ -11,7 +11,7 @@ #define ME_DEVICE_COUNT (33) #define ME_FUNCTION_COUNT (8) -namespace hCore::PCI { +namespace HCore::PCI { class Iterator final { public: Iterator() = delete; @@ -31,6 +31,6 @@ namespace hCore::PCI { private: Array m_Devices; }; -} // namespace hCore::PCI +} // namespace HCore::PCI #endif // __PCI_ITERATOR_HPP__ diff --git a/Private/KernelKit/PCI/PCI.hpp b/Private/KernelKit/PCI/PCI.hpp index 487d7614..a70688ce 100644 --- a/Private/KernelKit/PCI/PCI.hpp +++ b/Private/KernelKit/PCI/PCI.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright Mahrouss Logic, all rights reserved. * * ======================================================== @@ -17,7 +17,7 @@ #define PCI_FUNC_COUNT (8) #define PCI_BUS_COUNT (255) -namespace hCore::PCI { +namespace HCore::PCI { // model struct DeviceHeader { UInt16 VendorId; @@ -53,4 +53,4 @@ namespace hCore::PCI { Detail::BAR BAR4; Detail::BAR BAR5; }; -} // namespace hCore::PCI +} // namespace HCore::PCI diff --git a/Private/KernelKit/PEF.hpp b/Private/KernelKit/PEF.hpp index ecf90348..f259d8ac 100644 --- a/Private/KernelKit/PEF.hpp +++ b/Private/KernelKit/PEF.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -10,7 +10,7 @@ #ifndef _INC_LOADER_PEF_HPP #define _INC_LOADER_PEF_HPP -#include +#include #include #include @@ -24,7 +24,7 @@ // @brief Preferred Executable Format, a format designed for any computer. -namespace hCore +namespace HCore { enum { @@ -79,7 +79,7 @@ enum kPefZero = 0xE, kPefLinkerID = 0x1, }; -} // namespace hCore +} // namespace HCore #define kPefExt ".cm" #define kPefDylibExt ".dlib" @@ -87,7 +87,7 @@ enum #define kPefObjectExt ".obj" #define kPefDebugExt ".cmdbg" -// hCore System Binary Interface. +// HCore System Binary Interface. #define kPefAbi (0xDEAD2) #define kPefStart "__start" diff --git a/Private/KernelKit/PermissionSelector.hxx b/Private/KernelKit/PermissionSelector.hxx index 171325ee..805d29ff 100644 --- a/Private/KernelKit/PermissionSelector.hxx +++ b/Private/KernelKit/PermissionSelector.hxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -10,7 +10,7 @@ #ifndef _INC_PERMISSION_SEL_HPP #define _INC_PERMISSION_SEL_HPP -#include +#include #include // kernel mode user. @@ -23,7 +23,7 @@ // hash 'user@host:password' -> base64 encoded data // use this data to then fetch specific data. -namespace hCore +namespace HCore { enum class RingKind { diff --git a/Private/KernelKit/ProcessManager.hpp b/Private/KernelKit/ProcessManager.hpp index 89f94941..fec44adf 100644 --- a/Private/KernelKit/ProcessManager.hpp +++ b/Private/KernelKit/ProcessManager.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -21,7 +21,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -namespace hCore +namespace HCore { //! @brief Process identifier. typedef Int64 ProcessID; @@ -124,7 +124,7 @@ class Process final void AssignStart(UIntPtr &imageStart) noexcept; public: - Char Name[kProcessLen] = {"hCore Process"}; + Char Name[kProcessLen] = {"HCore Process"}; ProcessSubsystem SubSystem; ProcessSelector Selector; HAL::StackFrame *StackFrame{nullptr}; @@ -228,7 +228,7 @@ class ProcessHelper final }; const Int32 &rt_get_exit_code() noexcept; -} // namespace hCore +} // namespace HCore #include diff --git a/Private/KernelKit/SMPManager.hpp b/Private/KernelKit/SMPManager.hpp index f4317cc3..889f72c1 100644 --- a/Private/KernelKit/SMPManager.hpp +++ b/Private/KernelKit/SMPManager.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -10,13 +10,13 @@ #ifndef _INC_SMP_MANAGER_HPP #define _INC_SMP_MANAGER_HPP -#include +#include #include #include #define kMaxHarts 8 -namespace hCore +namespace HCore { using ThreadID = UInt32; @@ -116,6 +116,6 @@ namespace hCore // @brief makes thread sleep. // hooks and hangs thread to prevent code from executing. void rt_hang_thread(HAL::StackFrame* stack); -} // namespace hCore +} // namespace HCore #endif // !_INC_SMP_MANAGER_HPP diff --git a/Private/KernelKit/Semaphore.hpp b/Private/KernelKit/Semaphore.hpp index 252728b1..dda4ff16 100644 --- a/Private/KernelKit/Semaphore.hpp +++ b/Private/KernelKit/Semaphore.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -10,9 +10,9 @@ #pragma once #include -#include +#include -namespace hCore +namespace HCore { class Process; diff --git a/Private/KernelKit/SharedObjectCore.hxx b/Private/KernelKit/SharedObjectCore.hxx index 784e6e52..afda0080 100644 --- a/Private/KernelKit/SharedObjectCore.hxx +++ b/Private/KernelKit/SharedObjectCore.hxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -15,7 +15,7 @@ #include #include -namespace hCore +namespace HCore { class SharedObject final { @@ -90,6 +90,6 @@ inline void hcore_pure_call(void) // virtual placeholder. return; } -} // namespace hCore +} // namespace HCore #endif /* ifndef __KERNELKIT_SHARED_OBJECT_CORE_HXX__ */ diff --git a/Private/KernelKit/ThreadLocalStorage.hxx b/Private/KernelKit/ThreadLocalStorage.hxx index 8fc8b9dd..ef0ef730 100644 --- a/Private/KernelKit/ThreadLocalStorage.hxx +++ b/Private/KernelKit/ThreadLocalStorage.hxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -30,11 +30,11 @@ typedef char rt_cookie_type[3]; /// Located in GS on AMD64, Virtual Address 0x10000 (64x0, 32x0, ARM64) struct ThreadInformationBlock final { - hCore::Char Name[255]; // Module Name - hCore::UIntPtr StartCode; // Start Address - hCore::UIntPtr StartData; // Allocation Heap - hCore::UIntPtr StartStack; // Stack Pointer. - hCore::Int32 Arch; // Architecture and/or platform. + HCore::Char Name[255]; // Module Name + HCore::UIntPtr StartCode; // Start Address + HCore::UIntPtr StartData; // Allocation Heap + HCore::UIntPtr StartStack; // Stack Pointer. + HCore::Int32 Arch; // Architecture and/or platform. rt_cookie_type Cookie; // Not shown in public header, this is the way we tell something went wrong. }; @@ -42,7 +42,7 @@ struct ThreadInformationBlock final extern void rt_install_tib(ThreadInformationBlock *pTib); ///! @brief Cookie Sanity check. -hCore::Boolean hcore_tls_check(ThreadInformationBlock *ptr); +HCore::Boolean hcore_tls_check(ThreadInformationBlock *ptr); #include "ThreadLocalStorage.inl" diff --git a/Private/KernelKit/ThreadLocalStorage.inl b/Private/KernelKit/ThreadLocalStorage.inl index bf557122..2cf9c3a1 100644 --- a/Private/KernelKit/ThreadLocalStorage.inl +++ b/Private/KernelKit/ThreadLocalStorage.inl @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -12,7 +12,7 @@ template inline T* hcore_tls_new_ptr(void) { - using namespace hCore; + using namespace HCore; auto ref_process = ProcessManager::Shared().Leak().GetCurrent(); @@ -27,7 +27,7 @@ inline bool hcore_tls_delete_ptr(T* ptr) if (!ptr) return false; - using namespace hCore; + using namespace HCore; auto ref_process = ProcessManager::Shared().Leak().GetCurrent(); ptr->~T(); @@ -42,7 +42,7 @@ T* hcore_tls_new_class(Args&&... args) if (ptr) { - *ptr = T(hCore::forward(args)...); + *ptr = T(HCore::forward(args)...); return ptr; } diff --git a/Private/KernelKit/Timer.hpp b/Private/KernelKit/Timer.hpp index 057b4212..5839f099 100644 --- a/Private/KernelKit/Timer.hpp +++ b/Private/KernelKit/Timer.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -10,11 +10,11 @@ #pragma once #include -#include +#include #include -namespace hCore +namespace HCore { class HardwareTimer; class HardwareTimerInterface; @@ -65,4 +65,4 @@ inline Int64 Milliseconds(Int64 time) return 1000 / Seconds(time); } -} // namespace hCore +} // namespace HCore diff --git a/Private/Linker/16x0.json b/Private/Linker/16x0.json index 93088842..f41c0fc7 100644 --- a/Private/Linker/16x0.json +++ b/Private/Linker/16x0.json @@ -1,6 +1,6 @@ { "executable_type": "kernel", - "output_name": "hKernel.efi", + "output_name": "HCoreKrnl.efi", "start_proc": "Main", "format": "PEF" } diff --git a/Private/Linker/32x0.json b/Private/Linker/32x0.json index 93088842..f41c0fc7 100644 --- a/Private/Linker/32x0.json +++ b/Private/Linker/32x0.json @@ -1,6 +1,6 @@ { "executable_type": "kernel", - "output_name": "hKernel.efi", + "output_name": "HCoreKrnl.efi", "start_proc": "Main", "format": "PEF" } diff --git a/Private/Linker/64x0.json b/Private/Linker/64x0.json index 93088842..f41c0fc7 100644 --- a/Private/Linker/64x0.json +++ b/Private/Linker/64x0.json @@ -1,6 +1,6 @@ { "executable_type": "kernel", - "output_name": "hKernel.efi", + "output_name": "HCoreKrnl.efi", "start_proc": "Main", "format": "PEF" } diff --git a/Private/Linker/Platforms/PC.lds b/Private/Linker/Platforms/PC.lds index 88587e4c..2340258e 100644 --- a/Private/Linker/Platforms/PC.lds +++ b/Private/Linker/Platforms/PC.lds @@ -10,7 +10,7 @@ PHDRS { } SECTIONS { - . = 0x80000000; + . = 8M; .text : { *(.NewBoot) diff --git a/Private/NetworkKit/IP.hpp b/Private/NetworkKit/IP.hpp index 13fa0c9d..de9d6e74 100644 --- a/Private/NetworkKit/IP.hpp +++ b/Private/NetworkKit/IP.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright Mahrouss Logic, all rights reserved. * * ======================================================== @@ -14,7 +14,7 @@ #include #include -namespace hCore +namespace HCore { class RawIPAddress6; class RawIPAddress; @@ -84,4 +84,4 @@ class IPFactory final static bool IpCheckVersion4(const char *ip); }; -} // namespace hCore +} // namespace HCore diff --git a/Private/NetworkKit/NetworkDevice.hpp b/Private/NetworkKit/NetworkDevice.hpp index 801a325e..31a304cf 100644 --- a/Private/NetworkKit/NetworkDevice.hpp +++ b/Private/NetworkKit/NetworkDevice.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright Mahrouss Logic, all rights reserved. * * ======================================================== @@ -13,7 +13,7 @@ #include #include -namespace hCore +namespace HCore { struct NetworkDeviceCommand; @@ -48,6 +48,6 @@ namespace hCore using TCPNetworkDevice = NetworkDevice; using UDPNetworkDevice = NetworkDevice; using PPPNetworkDevice = NetworkDevice; -} // namespace hCore +} // namespace HCore #endif // !_INC_NETWORKDEVICE_HPP__ diff --git a/Private/NewBoot/BootKit/Boot.hxx b/Private/NewBoot/BootKit/Boot.hxx index 4bdc9c84..a6ff15c5 100644 --- a/Private/NewBoot/BootKit/Boot.hxx +++ b/Private/NewBoot/BootKit/Boot.hxx @@ -16,7 +16,7 @@ #include -using namespace hCore; +using namespace HCore; typedef void *PEFImage; @@ -70,8 +70,8 @@ enum { #define BK_START_KERNEL (0x80000000) -hCore::SizeT BStrLen(const char *ptr); -hCore::SizeT BSetMem(char *src, const char byte, const hCore::SizeT len); +HCore::SizeT BStrLen(const char *ptr); +HCore::SizeT BSetMem(char *src, const char byte, const HCore::SizeT len); /***********************************************************************************/ /// Include other APIs. diff --git a/Private/NewBoot/BootKit/Protocol.hxx b/Private/NewBoot/BootKit/Protocol.hxx index 26eef7e7..d9f7836a 100644 --- a/Private/NewBoot/BootKit/Protocol.hxx +++ b/Private/NewBoot/BootKit/Protocol.hxx @@ -18,7 +18,7 @@ #define kBaseHandoverStruct 0x80000000 #define kHandoverStructSz sizeof(HEL::HandoverHeader) -namespace hCore::HEL { +namespace HCore::HEL { /** @brief the kind of executable we're loading. */ @@ -66,4 +66,4 @@ struct HandoverInformationHeader { @brief Handover Jump Proc */ typedef UInt64 (*HandoverProc)(HandoverInformationHeader* pHandover); -} // namespace hCore::HEL +} // namespace HCore::HEL diff --git a/Private/NewBoot/Source/HEL/AMD64/Boot.cxx b/Private/NewBoot/Source/HEL/AMD64/Boot.cxx index 6bf63ffe..b3ff2206 100644 --- a/Private/NewBoot/Source/HEL/AMD64/Boot.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/Boot.cxx @@ -9,9 +9,9 @@ #include -constexpr hCore::UInt32 kVGABaseAddress = 0xb8000; +constexpr HCore::UInt32 kVGABaseAddress = 0xb8000; -hCore::SizeT BStrLen(const char *ptr) { +HCore::SizeT BStrLen(const char *ptr) { long long int cnt = 0; while (*ptr != 0) { @@ -22,8 +22,8 @@ hCore::SizeT BStrLen(const char *ptr) { return cnt; } -hCore::SizeT BSetMem(char *src, const char byte, const hCore::SizeT len) { - hCore::SizeT cnt = 0UL; +HCore::SizeT BSetMem(char *src, const char byte, const HCore::SizeT len) { + HCore::SizeT cnt = 0UL; while (*src != 0) { if (cnt > len) break; diff --git a/Private/NewKit/Array.hpp b/Private/NewKit/Array.hpp index f31442a5..ecac146c 100644 --- a/Private/NewKit/Array.hpp +++ b/Private/NewKit/Array.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -12,7 +12,7 @@ #include #include -namespace hCore +namespace HCore { template class Array final @@ -58,4 +58,4 @@ private: T m_Array[N]; }; -} // namespace hCore +} // namespace HCore diff --git a/Private/NewKit/ArrayList.hpp b/Private/NewKit/ArrayList.hpp index b6590c37..8921bebc 100644 --- a/Private/NewKit/ArrayList.hpp +++ b/Private/NewKit/ArrayList.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,7 +11,7 @@ #include -namespace hCore +namespace HCore { template class ArrayList final @@ -57,4 +57,4 @@ namespace hCore { return ArrayList{val}; } -} // namespace hCore +} // namespace HCore diff --git a/Private/NewKit/Atom.hpp b/Private/NewKit/Atom.hpp index a35f762d..46fe536b 100644 --- a/Private/NewKit/Atom.hpp +++ b/Private/NewKit/Atom.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -10,7 +10,7 @@ #include -namespace hCore +namespace HCore { template class Atom final { @@ -45,4 +45,4 @@ template class Atom final private: T m_ArrayOfAtoms; }; -} // namespace hCore +} // namespace HCore diff --git a/Private/NewKit/CRC32.hpp b/Private/NewKit/CRC32.hpp index 85be87e4..84b5a31f 100644 --- a/Private/NewKit/CRC32.hpp +++ b/Private/NewKit/CRC32.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore Date Added: 13/02/2023 + * HCore Date Added: 13/02/2023 * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -14,8 +14,8 @@ #define kCrcCnt (256) -namespace hCore { +namespace HCore { Int ke_calculate_crc32(const Char* crc, Int len) noexcept; -} // namespace hCore +} // namespace HCore #endif // !__CRC32_H__ diff --git a/Private/NewKit/CxxAbi.hpp b/Private/NewKit/CxxAbi.hpp index 6f1577de..12e4dc6e 100644 --- a/Private/NewKit/CxxAbi.hpp +++ b/Private/NewKit/CxxAbi.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/NewKit/Defines.hpp b/Private/NewKit/Defines.hpp index 7d674df3..b272364a 100644 --- a/Private/NewKit/Defines.hpp +++ b/Private/NewKit/Defines.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -14,7 +14,7 @@ #define NEWKIT_VERSION "1.0.0" #if !defined(_INC_NO_STDC_HEADERS) && defined(__GNUC__) -#include +#include #endif #ifdef __has_feature @@ -23,7 +23,7 @@ #endif #endif -namespace hCore { +namespace HCore { using voidPtr = void *; using VoidPtr = void *; using nullPtr = decltype(nullptr); @@ -77,14 +77,14 @@ template Args &&move(Args &&arg) { return static_cast(arg); } -} // namespace hCore +} // namespace HCore #define DEDUCE_ENDIAN(address, value) \ - (((reinterpret_cast(address)[0]) == (value)) \ - ? (hCore::Endian::kBig) \ - : (hCore::Endian::kLittle)) + (((reinterpret_cast(address)[0]) == (value)) \ + ? (HCore::Endian::kBig) \ + : (HCore::Endian::kLittle)) #define Yes (true) #define No (false) -#define VoidStar hCore::voidPtr +#define VoidStar HCore::voidPtr diff --git a/Private/NewKit/ErrorID.hpp b/Private/NewKit/ErrorID.hpp index 84dbe559..35285fd4 100644 --- a/Private/NewKit/ErrorID.hpp +++ b/Private/NewKit/ErrorID.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/NewKit/ErrorOr.hpp b/Private/NewKit/ErrorOr.hpp index 6514c2fd..dfe3fbe6 100644 --- a/Private/NewKit/ErrorOr.hpp +++ b/Private/NewKit/ErrorOr.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * -* hCore +* HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -12,7 +12,7 @@ #include #include -namespace hCore +namespace HCore { using ErrorT = UInt; @@ -65,4 +65,4 @@ template class ErrorOr final using ErrorOrAny = ErrorOr; -} // namespace hCore +} // namespace HCore diff --git a/Private/NewKit/Function.hpp b/Private/NewKit/Function.hpp index 772755e1..3addc636 100644 --- a/Private/NewKit/Function.hpp +++ b/Private/NewKit/Function.hpp @@ -3,7 +3,7 @@ #include -namespace hCore +namespace HCore { template class Function final @@ -44,6 +44,6 @@ namespace hCore T (*m_Fn)(Args... args); }; -} // namespace hCore +} // namespace HCore #endif // !_INC_FUNCTION_HPP__ diff --git a/Private/NewKit/Json.hpp b/Private/NewKit/Json.hpp index d4d42ab1..76ed0d99 100644 --- a/Private/NewKit/Json.hpp +++ b/Private/NewKit/Json.hpp @@ -2,7 +2,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -12,16 +12,16 @@ // last-rev: 30/01/24 -#include +#include #include #include #include #include -namespace hCore { +namespace HCore { class JsonType final { public: - explicit JsonType() : hCore::JsonType(1, 1) {} + explicit JsonType() : HCore::JsonType(1, 1) {} explicit JsonType(SizeT lhsLen, SizeT rhsLen) : fKey(lhsLen), fValue(rhsLen) {} @@ -86,4 +86,4 @@ struct JsonStreamTraits final { }; using JsonStream = Stream; -} // namespace hCore +} // namespace HCore diff --git a/Private/NewKit/KernelHeap.hpp b/Private/NewKit/KernelHeap.hpp index 301a2294..85e916d3 100644 --- a/Private/NewKit/KernelHeap.hpp +++ b/Private/NewKit/KernelHeap.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -16,7 +16,7 @@ #include #include -namespace hCore { +namespace HCore { Int32 kernel_delete_ptr(voidPtr allocatedPtr); voidPtr kernel_new_ptr(const SizeT &sz, const bool rw, const bool user); -} // namespace hCore +} // namespace HCore diff --git a/Private/NewKit/LockDelegate.hpp b/Private/NewKit/LockDelegate.hpp index e08b805a..97eae04b 100644 --- a/Private/NewKit/LockDelegate.hpp +++ b/Private/NewKit/LockDelegate.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -15,7 +15,7 @@ #define kLockDone (200U) /* job is done */ #define kLockTimedOut (100U) /* has timed out */ -namespace hCore +namespace HCore { template class LockDelegate final @@ -57,4 +57,4 @@ class LockDelegate final private: Atom m_LockStatus; }; -} // namespace hCore +} // namespace HCore diff --git a/Private/NewKit/Macros.hpp b/Private/NewKit/Macros.hpp index 6f72dadd..54f14f5f 100644 --- a/Private/NewKit/Macros.hpp +++ b/Private/NewKit/Macros.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -28,7 +28,7 @@ #ifndef ARRAY_SIZE #define ARRAY_SIZE(a) \ (((sizeof(a) / sizeof(*(a))) / \ - (static_cast(!(sizeof(a) % sizeof(*(a))))))) + (static_cast(!(sizeof(a) % sizeof(*(a))))))) #endif #ifndef ALIGN diff --git a/Private/NewKit/MutableArray.hpp b/Private/NewKit/MutableArray.hpp index fcc1c038..469b3bf1 100644 --- a/Private/NewKit/MutableArray.hpp +++ b/Private/NewKit/MutableArray.hpp @@ -1,14 +1,14 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== */ #pragma once -#include +#include #include #include @@ -47,7 +47,7 @@ // FIXME: this is a shitty algorithm, which is consumer hungry. // Remove and occurences of that, and remove that class. -namespace hCore +namespace HCore { template class MutableArray; @@ -145,7 +145,7 @@ template class NullableMutableArray MutableLinkedList *m_FirstNode{nullptr}; /* Number of nodes inside of this dynamic array. */ - hCore::SizeT m_NodeCount{0}; + HCore::SizeT m_NodeCount{0}; private: // don't remove that @@ -220,6 +220,6 @@ class MutableArray : public NullableMutableArray MutableLinkedList *m_FirstNode{nullptr}; /* Number of nodes inside of this dynamic array. */ - hCore::SizeT m_NodeCount{0}; + HCore::SizeT m_NodeCount{0}; }; -} // namespace hCore +} // namespace HCore diff --git a/Private/NewKit/New.hpp b/Private/NewKit/New.hpp index ba862788..47b9a38f 100644 --- a/Private/NewKit/New.hpp +++ b/Private/NewKit/New.hpp @@ -2,7 +2,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/NewKit/NewKit.hpp b/Private/NewKit/NewKit.hpp index 02931085..4ee9b463 100644 --- a/Private/NewKit/NewKit.hpp +++ b/Private/NewKit/NewKit.hpp @@ -2,7 +2,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Private/NewKit/OwnPtr.hpp b/Private/NewKit/OwnPtr.hpp index 9eb02f42..e1cc6890 100644 --- a/Private/NewKit/OwnPtr.hpp +++ b/Private/NewKit/OwnPtr.hpp @@ -2,7 +2,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,10 +11,10 @@ #pragma once #include -#include +#include #include -namespace hCore +namespace HCore { template class OwnPtr; @@ -64,4 +64,4 @@ template OwnPtr make_ptr(Args... args) return ret; } -} // namespace hCore +} // namespace HCore diff --git a/Private/NewKit/PageAllocator.hpp b/Private/NewKit/PageAllocator.hpp index 13a85ff8..9adae72c 100644 --- a/Private/NewKit/PageAllocator.hpp +++ b/Private/NewKit/PageAllocator.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -13,7 +13,7 @@ #include #include -namespace hCore +namespace HCore { namespace Detail { @@ -61,4 +61,4 @@ bool page_disable(UIntPtr addr); } // namespace Detail // TODO: SwapVirtualMemoryDevice class! -} // namespace hCore +} // namespace HCore diff --git a/Private/NewKit/PageManager.hpp b/Private/NewKit/PageManager.hpp index e4a529d0..f836000d 100644 --- a/Private/NewKit/PageManager.hpp +++ b/Private/NewKit/PageManager.hpp @@ -4,7 +4,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -20,7 +20,7 @@ #define kBadAddress (0) #endif // #ifndef kBadAddress -namespace hCore +namespace HCore { class PageManager; @@ -78,4 +78,4 @@ struct PageManager final friend PTEWrapper; friend class Pmm; }; -} // namespace hCore +} // namespace HCore diff --git a/Private/NewKit/Pair.hpp b/Private/NewKit/Pair.hpp index 4546cdbd..3472b515 100644 --- a/Private/NewKit/Pair.hpp +++ b/Private/NewKit/Pair.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,7 +11,7 @@ #include -namespace hCore +namespace HCore { -} // namespace hCore +} // namespace HCore diff --git a/Private/NewKit/Panic.hpp b/Private/NewKit/Panic.hpp deleted file mode 100644 index 4e461587..00000000 --- a/Private/NewKit/Panic.hpp +++ /dev/null @@ -1,66 +0,0 @@ - -/* - * ======================================================== - * - * hCore - * Copyright 2024 Mahrouss Logic, all rights reserved. - * - * ======================================================== - */ - -#pragma once - -#include - -namespace hCore -{ -void runtime_check(bool bExpression, const char *file, const char *line); -} - -#define MUST_PASS_COMPILER(EXPR, MSG) static_assert(EXPR, MSG) -#define MUST_PASS(EXPR) hCore::runtime_check(EXPR, __FILE__, " %d -> ") -#define assert(EXPR) MUST_PASS(EXPR, RUNTIME_CHECK_EXPRESSION) - -enum RUNTIME_CHECK -{ - RUNTIME_CHECK_FAILED = -1, - RUNTIME_CHECK_POINTER = 0, - RUNTIME_CHECK_EXPRESSION, - RUNTIME_CHECK_FILE, - RUNTIME_CHECK_IPC, - RUNTIME_CHECK_TLS, - RUNTIME_CHECK_LD, - RUNTIME_CHECK_HANDSHAKE, - RUNTIME_CHECK_ACPI, - RUNTIME_CHECK_INVALID_PRIVILEGE, - RUNTIME_CHECK_PROCESS, - RUNTIME_CHECK_BAD_BEHAVIOR, - RUNTIME_CHECK_COUNT, - RUNTIME_CHECK_BOOTSTRAP, -}; - -namespace hCore -{ -class DumpManager final -{ - public: - static void Dump(void) - { - // TODO: - } -}; - -void panic(const Int &id); -} // namespace hCore - -#ifdef TRY -#undef TRY -#endif - -#define INIT(OBJ, TYPE, ...) TYPE OBJ = TYPE(__VA_ARGS__) - -#define TRY(FN) \ - if (!FN()) \ - { \ - MUST_PASS(false); \ - } diff --git a/Private/NewKit/Pmm.hpp b/Private/NewKit/Pmm.hpp index 7473e5d6..af6e21ca 100644 --- a/Private/NewKit/Pmm.hpp +++ b/Private/NewKit/Pmm.hpp @@ -2,7 +2,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -13,7 +13,7 @@ #include #include -namespace hCore +namespace HCore { class Pmm; class PTEWrapper; @@ -42,4 +42,4 @@ namespace hCore Ref m_PageManager; }; -} // namespace hCore +} // namespace HCore diff --git a/Private/NewKit/Ref.hpp b/Private/NewKit/Ref.hpp index 3d20c506..8a5be930 100644 --- a/Private/NewKit/Ref.hpp +++ b/Private/NewKit/Ref.hpp @@ -2,7 +2,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,9 +11,9 @@ #pragma once #include -#include +#include -namespace hCore +namespace HCore { template class Ref final @@ -85,4 +85,4 @@ namespace hCore Ref m_Ref{nullptr}; }; -} // namespace hCore +} // namespace HCore diff --git a/Private/NewKit/RuntimeCheck.hpp b/Private/NewKit/RuntimeCheck.hpp new file mode 100644 index 00000000..62cca2c1 --- /dev/null +++ b/Private/NewKit/RuntimeCheck.hpp @@ -0,0 +1,66 @@ + +/* + * ======================================================== + * + * HCore + * Copyright 2024 Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#pragma once + +#include + +namespace HCore +{ +void runtime_check(bool bExpression, const char *file, const char *line); +} + +#define MUST_PASS_COMPILER(EXPR, MSG) static_assert(EXPR, MSG) +#define MUST_PASS(EXPR) HCore::runtime_check(EXPR, __FILE__, " %d -> ") +#define assert(EXPR) MUST_PASS(EXPR, RUNTIME_CHECK_EXPRESSION) + +enum RUNTIME_CHECK +{ + RUNTIME_CHECK_FAILED = -1, + RUNTIME_CHECK_POINTER = 0, + RUNTIME_CHECK_EXPRESSION, + RUNTIME_CHECK_FILE, + RUNTIME_CHECK_IPC, + RUNTIME_CHECK_TLS, + RUNTIME_CHECK_LD, + RUNTIME_CHECK_HANDSHAKE, + RUNTIME_CHECK_ACPI, + RUNTIME_CHECK_INVALID_PRIVILEGE, + RUNTIME_CHECK_PROCESS, + RUNTIME_CHECK_BAD_BEHAVIOR, + RUNTIME_CHECK_COUNT, + RUNTIME_CHECK_BOOTSTRAP, +}; + +namespace HCore +{ +class DumpManager final +{ + public: + static void Dump(void) + { + // TODO: + } +}; + +void ke_stop(const Int &id); +} // namespace HCore + +#ifdef TRY +#undef TRY +#endif + +#define INIT(OBJ, TYPE, ...) TYPE OBJ = TYPE(__VA_ARGS__) + +#define TRY(FN) \ + if (!FN()) \ + { \ + MUST_PASS(false); \ + } diff --git a/Private/NewKit/Stream.hpp b/Private/NewKit/Stream.hpp index fcbb6f8f..72330b6c 100644 --- a/Private/NewKit/Stream.hpp +++ b/Private/NewKit/Stream.hpp @@ -2,7 +2,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -13,7 +13,7 @@ #include #include -namespace hCore +namespace HCore { template class Stream final @@ -58,4 +58,4 @@ namespace hCore Ref m_Kind; }; -} // namespace hCore +} // namespace HCore diff --git a/Private/NewKit/String.hpp b/Private/NewKit/String.hpp index ec1bc814..73f48d3e 100644 --- a/Private/NewKit/String.hpp +++ b/Private/NewKit/String.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,9 +11,9 @@ #include #include -#include +#include -namespace hCore { +namespace HCore { class StringView final { public: explicit StringView() = default; @@ -63,4 +63,4 @@ struct StringBuilder final { static const char *Format(const char *fmt, const char *from); static bool Equals(const char *lhs, const char *rhs); }; -} // namespace hCore +} // namespace HCore diff --git a/Private/NewKit/UserHeap.hpp b/Private/NewKit/UserHeap.hpp index 71a93f6b..63a65528 100644 --- a/Private/NewKit/UserHeap.hpp +++ b/Private/NewKit/UserHeap.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -23,7 +23,7 @@ #define kPoolMaxSz 4096 #define kPoolMag 0x5500A1 -namespace hCore +namespace HCore { enum { @@ -44,4 +44,4 @@ namespace hCore VoidPtr pool_new_ptr(Int32 flags); Int32 pool_free_ptr(voidPtr pointer); Boolean pool_ptr_exists(UIntPtr thePool, UIntPtr thePtr, SizeT theLimit); -} // namespace hCore +} // namespace HCore diff --git a/Private/NewKit/Utils.hpp b/Private/NewKit/Utils.hpp index adc4f3b9..02dcd00a 100644 --- a/Private/NewKit/Utils.hpp +++ b/Private/NewKit/Utils.hpp @@ -2,7 +2,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -12,7 +12,7 @@ #include -namespace hCore +namespace HCore { Int rt_copy_memory(const voidPtr src, voidPtr dst, Size len); Int rt_move_memory(const voidPtr src, voidPtr dst, Size len); @@ -29,4 +29,4 @@ namespace hCore Int to_lower(Int c); voidPtr string_in_string(const char* in, const char* needle); char* string_from_char(char* str, const char chr); -} // namespace hCore +} // namespace HCore diff --git a/Private/NewKit/Variant.hpp b/Private/NewKit/Variant.hpp index 3493da01..23316ec1 100644 --- a/Private/NewKit/Variant.hpp +++ b/Private/NewKit/Variant.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -12,7 +12,7 @@ #include #include -namespace hCore +namespace HCore { class Variant final { @@ -46,4 +46,4 @@ namespace hCore VariantKind m_Kind{VariantKind::kUndefined}; }; -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/Array.cxx b/Private/Source/Array.cxx index 86ef7310..3f4f8cfa 100644 --- a/Private/Source/Array.cxx +++ b/Private/Source/Array.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/Source/ArrayList.cxx b/Private/Source/ArrayList.cxx index cc89dc2e..05ee7472 100644 --- a/Private/Source/ArrayList.cxx +++ b/Private/Source/ArrayList.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/Source/Atom.cxx b/Private/Source/Atom.cxx index 018790b0..15c557a7 100644 --- a/Private/Source/Atom.cxx +++ b/Private/Source/Atom.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/Source/CodeManager.cxx b/Private/Source/CodeManager.cxx index ced403cc..364a94f6 100644 --- a/Private/Source/CodeManager.cxx +++ b/Private/Source/CodeManager.cxx @@ -1,162 +1,137 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== */ -#include "NewKit/Defines.hpp" -#include "NewKit/Panic.hpp" #include #include #include #include +#include #include #include #include +#include #include -namespace hCore -{ -namespace Detail -{ -UInt32 rt_get_pef_platform(void) noexcept -{ +namespace HCore { +namespace Detail { +UInt32 rt_get_pef_platform(void) noexcept { #ifdef __32x0__ - return kPefArch32x0; + return kPefArch32x0; #elif defined(__64x0__) - return kPefArch64x0; + return kPefArch64x0; #elif defined(__x86_64__) - return kPefArchAMD64; + return kPefArchAMD64; #else - return kPefArchInvalid; -#endif // __POWER || __x86_64__ + return kPefArchInvalid; +#endif // __POWER || __x86_64__ } -} // namespace Detail +} // namespace Detail -PEFLoader::PEFLoader(const VoidPtr blob) : fCachedBlob(nullptr) -{ - fCachedBlob = blob; - fBad = false; +PEFLoader::PEFLoader(const VoidPtr blob) : fCachedBlob(nullptr) { + fCachedBlob = blob; + fBad = false; - MUST_PASS(fCachedBlob); + MUST_PASS(fCachedBlob); } -PEFLoader::PEFLoader(const char *path) : fCachedBlob(nullptr), fBad(false) -{ - OwnPtr> file; +PEFLoader::PEFLoader(const char *path) : fCachedBlob(nullptr), fBad(false) { + OwnPtr> file; - file.New(const_cast(path)); + file.New(const_cast(path)); - if (StringBuilder::Equals(file->MIME(), this->MIME())) - { - fPath = StringBuilder::Construct(path).Leak(); + if (StringBuilder::Equals(file->MIME(), this->MIME())) { + fPath = StringBuilder::Construct(path).Leak(); - fCachedBlob = file->ReadAll(); + fCachedBlob = file->ReadAll(); - PEFContainer *container = reinterpret_cast(fCachedBlob); - - auto fFree = [&]() -> void { - kcout << "CodeManager: Warning: Bad executable, program will not be started!\n"; - fBad = true; - - kernel_delete_ptr(fCachedBlob); - - fCachedBlob = nullptr; - }; - - if (container->Cpu == Detail::rt_get_pef_platform() && container->Magic[0] == kPefMagic[0] && - container->Magic[1] == kPefMagic[1] && container->Magic[2] == kPefMagic[2] && container->Abi == kPefAbi) - { - if (container->Kind != kPefKindObject && container->Kind != kPefKindDebug) - { - kcout << "CodeManager: Info: Good executable. can proceed.\n"; - return; - } - } + PEFContainer *container = reinterpret_cast(fCachedBlob); - fFree(); + auto fFree = [&]() -> void { + kcout << "CodeManager: Warning: Bad executable, program will not be " + "started!\n"; + fBad = true; + + kernel_delete_ptr(fCachedBlob); + + fCachedBlob = nullptr; + }; + + if (container->Cpu == Detail::rt_get_pef_platform() && + container->Magic[0] == kPefMagic[0] && + container->Magic[1] == kPefMagic[1] && + container->Magic[2] == kPefMagic[2] && container->Abi == kPefAbi) { + if (container->Kind != kPefKindObject && + container->Kind != kPefKindDebug) { + kcout << "CodeManager: Info: Good executable. can proceed.\n"; + return; + } } + + fFree(); + } } -PEFLoader::~PEFLoader() -{ - if (fCachedBlob) - kernel_delete_ptr(fCachedBlob); +PEFLoader::~PEFLoader() { + if (fCachedBlob) kernel_delete_ptr(fCachedBlob); } -VoidPtr PEFLoader::FindSymbol(const char *name, Int32 kind) -{ - if (!fCachedBlob || fBad) - return nullptr; +VoidPtr PEFLoader::FindSymbol(const char *name, Int32 kind) { + if (!fCachedBlob || fBad) return nullptr; - PEFContainer *container = reinterpret_cast(fCachedBlob); + PEFContainer *container = reinterpret_cast(fCachedBlob); - PEFCommandHeader *container_header = - reinterpret_cast((UIntPtr)fCachedBlob + sizeof(PEFContainer)); + PEFCommandHeader *container_header = reinterpret_cast( + (UIntPtr)fCachedBlob + sizeof(PEFContainer)); - for (SizeT index = 0; index < container->Count; ++index) - { - kcout << "Iterating over container at index: " << StringBuilder::FromInt("%", index) - << ", name: " << container_header->Name << "\n"; + for (SizeT index = 0; index < container->Count; ++index) { + kcout << "Iterating over container at index: " + << StringBuilder::FromInt("%", index) + << ", name: " << container_header->Name << "\n"; - if (StringBuilder::Equals(container_header->Name, name)) - { - kcout << "Found potential container, checking for validity.\n"; + if (StringBuilder::Equals(container_header->Name, name)) { + kcout << "Found potential container, checking for validity.\n"; - if (container_header->Kind == kind) - return static_cast(fCachedBlob) + container_header->Offset; + if (container_header->Kind == kind) + return static_cast(fCachedBlob) + container_header->Offset; - continue; - } + continue; } + } - return nullptr; + return nullptr; } -ErrorOr PEFLoader::LoadStart() -{ - if (auto sym = this->FindSymbol("__start", kPefCode); sym) - return ErrorOr(sym); +ErrorOr PEFLoader::LoadStart() { + if (auto sym = this->FindSymbol("__start", kPefCode); sym) + return ErrorOr(sym); - return ErrorOr(H_EXEC_ERROR); + return ErrorOr(H_EXEC_ERROR); } -bool PEFLoader::IsLoaded() noexcept -{ - return !fBad && fCachedBlob; -} +bool PEFLoader::IsLoaded() noexcept { return !fBad && fCachedBlob; } -namespace Utils -{ -bool execute_from_image(PEFLoader &exec) noexcept -{ - auto errOrStart = exec.LoadStart(); +namespace Utils { +bool execute_from_image(PEFLoader &exec) noexcept { + auto errOrStart = exec.LoadStart(); - if (errOrStart.Error() != 0) - return false; + if (errOrStart.Error() != 0) return false; - Process proc(errOrStart.Leak().Leak()); - Ref refProc = proc; + Process proc(errOrStart.Leak().Leak()); + Ref refProc = proc; - return ProcessManager::Shared().Leak().Add(refProc); + return ProcessManager::Shared().Leak().Add(refProc); } -} // namespace Utils +} // namespace Utils -const char *PEFLoader::Path() -{ - return fPath.Leak().CData(); -} +const char *PEFLoader::Path() { return fPath.Leak().CData(); } -const char *PEFLoader::Format() -{ - return "PEF"; -} +const char *PEFLoader::Format() { return "PEF"; } -const char *PEFLoader::MIME() -{ - return "application/x-exec"; -} -} // namespace hCore +const char *PEFLoader::MIME() { return "application/x-exec"; } +} // namespace HCore diff --git a/Private/Source/Crc32.cxx b/Private/Source/Crc32.cxx index 233d9847..7d17ae99 100644 --- a/Private/Source/Crc32.cxx +++ b/Private/Source/Crc32.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -12,7 +12,7 @@ // @file CRC32.cpp // @brief Checksum implementation. -namespace hCore { +namespace HCore { UInt kCrcTbl[kCrcCnt] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, @@ -67,4 +67,4 @@ Int ke_calculate_crc32(const Char *p, Int len) noexcept { // return (~crc); also works return (crc ^ 0xffffffff); } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/CxxAbi.cxx b/Private/Source/CxxAbi.cxx index 49b5834a..11120a26 100644 --- a/Private/Source/CxxAbi.cxx +++ b/Private/Source/CxxAbi.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -9,7 +9,7 @@ #include #include -#include +#include #ifdef __GNUC__ @@ -18,13 +18,11 @@ void *__dso_handle; atexit_func_entry_t __atexit_funcs[DSO_MAX_OBJECTS]; uarch_t __atexit_func_count; -extern "C" void __cxa_pure_virtual() { - hCore::kcout << "[__cxa_pure_virtual] Placeholder\n"; -} +extern "C" void __cxa_pure_virtual() { HCore::kcout << "[C++] Placeholder\n"; } extern "C" void __stack_chk_fail() { - hCore::kcout << "[__stack_chk_fail] Buffer overflow detected\n"; - hCore::panic(RUNTIME_CHECK_POINTER); + HCore::kcout << "[HCoreKrnl] Buffer overflow detected\n"; + HCore::ke_stop(RUNTIME_CHECK_POINTER); } extern "C" int __cxa_atexit(void (*f)(void *), void *arg, void *dso) { diff --git a/Private/Source/CxxKitRT.cxx b/Private/Source/CxxKitRT.cxx index e608ab3c..efe4d9f2 100644 --- a/Private/Source/CxxKitRT.cxx +++ b/Private/Source/CxxKitRT.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,7 +11,7 @@ #include #include -using namespace hCore; +using namespace HCore; // unimplemented _HintTell void _HintTell(_HintMessage* ppMsg, _HintId* pId) { diff --git a/Private/Source/Defines.cxx b/Private/Source/Defines.cxx index 3e0bd946..db16111d 100644 --- a/Private/Source/Defines.cxx +++ b/Private/Source/Defines.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/Source/Device.cxx b/Private/Source/Device.cxx index 484c20a3..df256b3b 100644 --- a/Private/Source/Device.cxx +++ b/Private/Source/Device.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/Source/DriveManager.cxx b/Private/Source/DriveManager.cxx index ee279ed1..9611575d 100644 --- a/Private/Source/DriveManager.cxx +++ b/Private/Source/DriveManager.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -10,7 +10,7 @@ #include #include -namespace hCore { +namespace HCore { DriveSelector::DriveSelector() : fDrive(nullptr) {} DriveSelector::~DriveSelector() { @@ -49,4 +49,4 @@ DriveTraits *DriveSelector::Unmount() { return drivePointer; } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/ErrorOr.cxx b/Private/Source/ErrorOr.cxx index aff86ed0..ab8a5701 100644 --- a/Private/Source/ErrorOr.cxx +++ b/Private/Source/ErrorOr.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/Source/FileManager.cxx b/Private/Source/FileManager.cxx index 9bf26c29..a0482f03 100644 --- a/Private/Source/FileManager.cxx +++ b/Private/Source/FileManager.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,9 +11,9 @@ #include #include -//! @brief File manager for hCore. +//! @brief File manager for HCore. -namespace hCore { +namespace HCore { static IFilesystemManager* kMounted = nullptr; /// @brief FilesystemManager getter. @@ -39,4 +39,4 @@ bool IFilesystemManager::Mount(IFilesystemManager* pMount) { return false; } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/Framebuffer.cxx b/Private/Source/Framebuffer.cxx index 1a73e449..9164e913 100644 --- a/Private/Source/Framebuffer.cxx +++ b/Private/Source/Framebuffer.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -9,15 +9,15 @@ #include -namespace hCore { -Framebuffer::Framebuffer(hCore::Ref& addr) +namespace HCore { +Framebuffer::Framebuffer(HCore::Ref& addr) : m_FrameBufferAddr(addr), m_Colour(FramebufferColorKind::RGB32) {} Framebuffer::~Framebuffer() = default; volatile UIntPtr* Framebuffer::operator[](const UIntPtr& width_and_height) { if (m_FrameBufferAddr) - return reinterpret_cast( + return reinterpret_cast( m_FrameBufferAddr->m_Base + width_and_height); return nullptr; @@ -33,4 +33,4 @@ const FramebufferColorKind& Framebuffer::Color( return m_Colour; } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/GUIDWizard.cxx b/Private/Source/GUIDWizard.cxx index d3b11b0a..57915f64 100644 --- a/Private/Source/GUIDWizard.cxx +++ b/Private/Source/GUIDWizard.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -16,7 +16,7 @@ // @brief Size of UUID. #define kUUIDSize 32 -namespace hCore::XRN::Version1 { +namespace HCore::XRN::Version1 { auto make_sequence(const ArrayList& uuidSeq) -> Ref { GUIDSequence* seq = new GUIDSequence(); MUST_PASS(seq); @@ -54,4 +54,4 @@ auto try_guid_to_string(Ref& seq) -> ErrorOr> { return ErrorOr>{-1}; } -} // namespace hCore::XRN::Version1 +} // namespace HCore::XRN::Version1 diff --git a/Private/Source/GUIDWrapper.cxx b/Private/Source/GUIDWrapper.cxx index fa9a52a6..5626a592 100644 --- a/Private/Source/GUIDWrapper.cxx +++ b/Private/Source/GUIDWrapper.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -9,4 +9,4 @@ #include -namespace hCore::XRN {} +namespace HCore::XRN {} diff --git a/Private/Source/IndexableProperty.cxx b/Private/Source/IndexableProperty.cxx index 2dac5a09..7c322e11 100644 --- a/Private/Source/IndexableProperty.cxx +++ b/Private/Source/IndexableProperty.cxx @@ -1,26 +1,26 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== */ -//! @brief hCore NewFS Indexer. +//! @brief HCore NewFS Indexer. -#include +#include #include #include #include #define kMaxLenIndexer 256 -namespace hCore { +namespace HCore { namespace Indexer { IndexProperty& IndexableProperty::LeakProperty() noexcept { return fIndex; } void IndexableProperty::AddFlag(Int16 flag) { fFlags |= flag; } void IndexableProperty::RemoveFlag(Int16 flag) { fFlags &= flag; } } // namespace Indexer -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/Json.cxx b/Private/Source/Json.cxx index adfd571d..835c1fda 100644 --- a/Private/Source/Json.cxx +++ b/Private/Source/Json.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -9,7 +9,7 @@ #include -using namespace hCore; +using namespace HCore; /// @brief Undefined object, is null in length. -INIT(hCore::JsonType::kUndefined, hCore::JsonType); +INIT(HCore::JsonType::kUndefined, HCore::JsonType); diff --git a/Private/Source/KernelHeap.cxx b/Private/Source/KernelHeap.cxx index 02688a2f..94e9156c 100644 --- a/Private/Source/KernelHeap.cxx +++ b/Private/Source/KernelHeap.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -14,7 +14,7 @@ #define kMaxWrappers (4096 * 8) -namespace hCore { +namespace HCore { static Ref kWrapperList[kMaxWrappers]; static SizeT kWrapperCount = 0UL; static Ref kLastWrapper; @@ -106,4 +106,4 @@ Boolean kernel_valid_ptr(voidPtr ptr) { return false; } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/LockDelegate.cxx b/Private/Source/LockDelegate.cxx index d6608e60..1b3144a0 100644 --- a/Private/Source/LockDelegate.cxx +++ b/Private/Source/LockDelegate.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/Source/MeBus/Database.cxx b/Private/Source/MeBus/Database.cxx index 3c7594d5..387466c9 100644 --- a/Private/Source/MeBus/Database.cxx +++ b/Private/Source/MeBus/Database.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/Source/MutableArray.cxx b/Private/Source/MutableArray.cxx index b10a0785..e9faebe7 100644 --- a/Private/Source/MutableArray.cxx +++ b/Private/Source/MutableArray.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/Source/Network/IP.cpp b/Private/Source/Network/IP.cpp index 4e8f602a..f58e59b6 100644 --- a/Private/Source/Network/IP.cpp +++ b/Private/Source/Network/IP.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * NewKit + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -10,7 +10,7 @@ #include #include -namespace hCore { +namespace HCore { char* RawIPAddress::Address() { return m_Addr; } RawIPAddress::RawIPAddress(char bytes[4]) { rt_copy_memory(bytes, m_Addr, 4); } @@ -34,7 +34,8 @@ bool RawIPAddress::operator!=(const RawIPAddress& ipv4) { char& RawIPAddress::operator[](const Size& index) { kcout << "[RawIPAddress::operator[]] Fetching Index...\r\n"; - if (index > 4) panic(RUNTIME_CHECK_EXPRESSION); + static char IP_PLACEHOLDER = '0'; + if (index > 4) return IP_PLACEHOLDER; return m_Addr[index]; } @@ -46,7 +47,8 @@ RawIPAddress6::RawIPAddress6(char bytes[8]) { char& RawIPAddress6::operator[](const Size& index) { kcout << "[RawIPAddress6::operator[]] Fetching Index...\r\n"; - if (index > 8) panic(RUNTIME_CHECK_EXPRESSION); + static char IP_PLACEHOLDER = '0'; + if (index > 8) return IP_PLACEHOLDER; return m_Addr[index]; } @@ -92,4 +94,4 @@ bool IPFactory::IpCheckVersion4(const char* ip) { return true; } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/Network/NetworkDevice.cpp b/Private/Source/Network/NetworkDevice.cpp index bd75d7ed..4f07a5eb 100644 --- a/Private/Source/Network/NetworkDevice.cpp +++ b/Private/Source/Network/NetworkDevice.cpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * NewKit + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -12,7 +12,7 @@ // network devices implementation. // PPPNetworkService, TCPNetworkDevice, UDPNetworkService -namespace hCore { +namespace HCore { NetworkDevice::NetworkDevice(void (*out)(NetworkDeviceCommand), void (*in)(NetworkDeviceCommand), void (*on_cleanup)(void)) @@ -29,4 +29,4 @@ NetworkDevice::~NetworkDevice() { if (fCleanup) fCleanup(); } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/New+Delete.cxx b/Private/Source/New+Delete.cxx index 0e247e0c..e4dba396 100644 --- a/Private/Source/New+Delete.cxx +++ b/Private/Source/New+Delete.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -15,7 +15,7 @@ void* operator new[](size_t sz) if (sz == 0) ++sz; - return hCore::kernel_new_ptr(sz, true, false); + return HCore::kernel_new_ptr(sz, true, false); } void* operator new(size_t sz) @@ -23,7 +23,7 @@ void* operator new(size_t sz) if (sz == 0) ++sz; - return hCore::kernel_new_ptr(sz, true, false); + return HCore::kernel_new_ptr(sz, true, false); } void operator delete[](void* ptr) @@ -31,7 +31,7 @@ void operator delete[](void* ptr) if (ptr == nullptr) return; - hCore::kernel_delete_ptr(ptr); + HCore::kernel_delete_ptr(ptr); } void operator delete(void* ptr) @@ -39,7 +39,7 @@ void operator delete(void* ptr) if (ptr == nullptr) return; - hCore::kernel_delete_ptr(ptr); + HCore::kernel_delete_ptr(ptr); } void operator delete(void* ptr, size_t sz) @@ -49,6 +49,6 @@ void operator delete(void* ptr, size_t sz) (void)sz; - hCore::kernel_delete_ptr(ptr); + HCore::kernel_delete_ptr(ptr); } diff --git a/Private/Source/NewFS-IO.cxx b/Private/Source/NewFS-IO.cxx index b9ecfd52..f5d550e0 100644 --- a/Private/Source/NewFS-IO.cxx +++ b/Private/Source/NewFS-IO.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/Source/NewFS-Journal.cxx b/Private/Source/NewFS-Journal.cxx index 14ba417f..8b79abbf 100644 --- a/Private/Source/NewFS-Journal.cxx +++ b/Private/Source/NewFS-Journal.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -14,7 +14,7 @@ #define kOpCache (4) -namespace hCore { +namespace HCore { typedef Boolean (*NewFSRunner)(VoidPtr delegate); class NewFSJournalRunner final { @@ -56,4 +56,4 @@ class NewFSJournalRunner final { return false; } }; -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/NewFS.cxx b/Private/Source/NewFS.cxx index 2283e779..09f11b87 100644 --- a/Private/Source/NewFS.cxx +++ b/Private/Source/NewFS.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -10,7 +10,7 @@ #include #include -namespace hCore { +namespace HCore { NewFilesystemManager::NewFilesystemManager() = default; NewFilesystemManager::~NewFilesystemManager() = default; @@ -40,4 +40,4 @@ NodePtr NewFilesystemManager::CreateDirectory(const char* path) { NodePtr NewFilesystemManager::CreateAlias(const char* path) { return node_cast(fIO->CreateCatalog(path, 0, kCatalogKindAlias)); } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/OSErr.cxx b/Private/Source/OSErr.cxx index 6c37c40d..791127b4 100644 --- a/Private/Source/OSErr.cxx +++ b/Private/Source/OSErr.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/Source/OwnPtr.cxx b/Private/Source/OwnPtr.cxx index f7f9d31f..42ce6244 100644 --- a/Private/Source/OwnPtr.cxx +++ b/Private/Source/OwnPtr.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/Source/PRDT.cxx b/Private/Source/PRDT.cxx index 8ea2ee70..4749dcda 100644 --- a/Private/Source/PRDT.cxx +++ b/Private/Source/PRDT.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,7 +11,7 @@ #include #include -namespace hCore { +namespace HCore { PRDT::PRDT(const UIntPtr& physAddr) : m_PrdtAddr(physAddr) { MUST_PASS(physAddr); kcout << "PRDT::PRDT() {}\r\n"; @@ -32,4 +32,4 @@ PRDT& PRDT::operator=(const UIntPtr& prdtAddress) { m_PrdtAddr = prdtAddress; return *this; } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/PageAllocator.cxx b/Private/Source/PageAllocator.cxx index 59ad6b28..3e630aa1 100644 --- a/Private/Source/PageAllocator.cxx +++ b/Private/Source/PageAllocator.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -12,13 +12,13 @@ #include // empty for now. -namespace hCore::Detail { +namespace HCore::Detail { UIntPtr create_page_wrapper(Boolean rw, Boolean user) { auto addr = HAL::hal_create_page(rw, user); if (addr == kBadAddress) { kcout << "[create_page_wrapper] kBadAddress returned\n"; - panic(RUNTIME_CHECK_POINTER); + ke_stop(RUNTIME_CHECK_POINTER); } return addr; @@ -47,4 +47,4 @@ bool page_disable(UIntPtr VirtualAddr) { return false; } -} // namespace hCore::Detail +} // namespace HCore::Detail diff --git a/Private/Source/PageManager.cxx b/Private/Source/PageManager.cxx index 32c1f22a..95300bd9 100644 --- a/Private/Source/PageManager.cxx +++ b/Private/Source/PageManager.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -10,7 +10,7 @@ #include #include -namespace hCore { +namespace HCore { PTEWrapper::PTEWrapper(Boolean Rw, Boolean User, Boolean ExecDisable, UIntPtr VirtAddr) : m_Rw(Rw), @@ -62,7 +62,7 @@ bool PTEWrapper::Reclaim() { PTEWrapper *PageManager::Request(Boolean Rw, Boolean User, Boolean ExecDisable) { PTEWrapper *PageTableEntry = reinterpret_cast( - hCore::HAL::hal_alloc_page(sizeof(PTEWrapper), Rw, User)); + HCore::HAL::hal_alloc_page(sizeof(PTEWrapper), Rw, User)); if (PageTableEntry == nullptr) { kcout << "PTEWrapper : Page table is nullptr!, kernel_new_ptr failed!"; @@ -120,4 +120,4 @@ bool PTEWrapper::Access() { return m_Accessed; } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/Panic.cxx b/Private/Source/Panic.cxx deleted file mode 100644 index 9e3dddfb..00000000 --- a/Private/Source/Panic.cxx +++ /dev/null @@ -1,49 +0,0 @@ -/* - * ======================================================== - * - * hCore - * Copyright 2024 Mahrouss Logic, all rights reserved. - * - * ======================================================== - */ - -#include -#include -#include -#include - -extern "C" [[noreturn]] void wait_for_debugger() { - while (true) { - hCore::HAL::rt_cli(); - hCore::HAL::rt_halt(); - } -} - -/* Each error code is attributed with an ID, which will prompt a string onto the - * screen. Wait for debugger... */ - -namespace hCore { -void panic(const hCore::Int &id) { -#ifdef __DEBUG__ - kcout << "hCore: Kernel Panic! \r\n"; - kcout << StringBuilder::FromInt("kError : %\n", id); - - DumpManager::Dump(); -#endif // __DEBUG__ - - wait_for_debugger(); -} - -void runtime_check(bool expr, const char *file, const char *line) { - if (!expr) { -#ifdef __DEBUG__ - kcout << "[KERNEL] Check Failed!\n"; - kcout << "[KERNEL] File: " << file << "\n"; - kcout << "[KERNEL] Where: " << line << "\n"; - -#endif // __DEBUG__ - - hCore::panic(RUNTIME_CHECK_FAILED); // Runtime Check failed - } -} -} // namespace hCore diff --git a/Private/Source/PermissionSelector.cxx b/Private/Source/PermissionSelector.cxx index 69bb949b..299a35a6 100644 --- a/Private/Source/PermissionSelector.cxx +++ b/Private/Source/PermissionSelector.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * File: PermissionSelector.cpp @@ -11,9 +11,9 @@ */ #include -#include +#include -namespace hCore { +namespace HCore { PermissionSelector::PermissionSelector(const Int32 &sel) : fRing((RingKind)sel) { MUST_PASS(sel > 0); @@ -33,4 +33,4 @@ bool PermissionSelector::operator!=(const PermissionSelector &lhs) { } const RingKind &PermissionSelector::Ring() noexcept { return this->fRing; } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/Pmm.cxx b/Private/Source/Pmm.cxx index b87e450b..3f335d45 100644 --- a/Private/Source/Pmm.cxx +++ b/Private/Source/Pmm.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -10,7 +10,7 @@ #include #include -namespace hCore { +namespace HCore { Pmm::Pmm() = default; Pmm::Pmm(Ref &pm) : m_PageManager(pm) { @@ -75,4 +75,4 @@ Boolean Pmm::ToggleShare(Ref PageRef, Boolean Enable) { return true; } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/ProcessManager.cxx b/Private/Source/ProcessManager.cxx index ce20cad4..9d1792a2 100644 --- a/Private/Source/ProcessManager.cxx +++ b/Private/Source/ProcessManager.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -17,7 +17,7 @@ #include #include -#include "NewKit/Panic.hpp" +#include "NewKit/RuntimeCheck.hpp" ///! bugs = 0 @@ -27,7 +27,7 @@ * For MT see SMPManager. */ /***********************************************************************************/ -namespace hCore { +namespace HCore { /***********************************************************************************/ /// Exit Code stuff /***********************************************************************************/ @@ -122,11 +122,11 @@ const AffinityKind &Process::GetAffinity() { return this->Affinity; } void Process::Exit(Int32 exit_code) { if (this->ProcessId != ProcessManager::Shared().Leak().GetCurrent().Leak().ProcessId) - panic(RUNTIME_CHECK_PROCESS); + ke_stop(RUNTIME_CHECK_PROCESS); if (this->Ring == (Int32)ProcessSelector::kRingKernel && ProcessManager::Shared().Leak().GetCurrent().Leak().Ring > 0) - panic(RUNTIME_CHECK_PROCESS); + ke_stop(RUNTIME_CHECK_PROCESS); kExitCode = exit_code; @@ -283,4 +283,4 @@ bool ProcessHelper::Switch(HAL::StackFrame *the_stack, const PID &new_pid) { return false; } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/Property.cxx b/Private/Source/Property.cxx index f3633598..8128e241 100644 --- a/Private/Source/Property.cxx +++ b/Private/Source/Property.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -9,10 +9,10 @@ #include -namespace hCore { +namespace HCore { bool Property::StringEquals(StringView& name) { return m_sName && this->m_sName == name; } const PropertyId& Property::GetPropertyById() { return m_Action; } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/Ref.cxx b/Private/Source/Ref.cxx index 28064552..9f2d4b58 100644 --- a/Private/Source/Ref.cxx +++ b/Private/Source/Ref.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/Source/RuntimeCheck.cxx b/Private/Source/RuntimeCheck.cxx new file mode 100644 index 00000000..09440a20 --- /dev/null +++ b/Private/Source/RuntimeCheck.cxx @@ -0,0 +1,81 @@ +/* + * ======================================================== + * + * HCore + * Copyright 2024 Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#include +#include +#include +#include + +extern "C" [[noreturn]] void wait_for_debugger() { + while (true) { + HCore::HAL::rt_cli(); + HCore::HAL::rt_halt(); + } +} + +/* Each error code is attributed with an ID, which will prompt a string onto the + * screen. Wait for debugger... */ + +namespace HCore { +void ke_stop(const HCore::Int &id) { + kcout << "*** STOP *** \r\n"; + kcout << "*** HCoreKrnl.exe has trigerred a runtime breakpoint. *** \r\n"; + + switch (id) { + case RUNTIME_CHECK_PROCESS: { + kcout << "*** CAUSE: RUNTIME_CHECK_PROCESS *** \r\n"; + break; + } + case RUNTIME_CHECK_ACPI: { + kcout << "*** CAUSE: RUNTIME_CHECK_ACPI *** \r\n"; + break; + } + case RUNTIME_CHECK_POINTER: { + kcout << "*** CAUSE: RUNTIME_CHECK_POINTER *** \r\n"; + break; + } + case RUNTIME_CHECK_BAD_BEHAVIOR: { + kcout << "*** CAUSE: RUNTIME_CHECK_BAD_BEHAVIOR *** \r\n"; + break; + } + case RUNTIME_CHECK_BOOTSTRAP: { + kcout << "*** CAUSE: RUNTIME_CHECK_BOOTSTRAP *** \r\n"; + break; + } + case RUNTIME_CHECK_HANDSHAKE: { + kcout << "*** CAUSE: RUNTIME_CHECK_HANDSHAKE *** \r\n"; + break; + } + case RUNTIME_CHECK_LD: { + kcout << "*** CAUSE: RUNTIME_CHECK_LD *** \r\n"; + break; + } + case RUNTIME_CHECK_INVALID_PRIVILEGE: { + kcout << "*** CAUSE: RUNTIME_CHECK_INVALID_PRIVILEGE *** \r\n"; + break; + } + }; + + DumpManager::Dump(); + wait_for_debugger(); +} + +void runtime_check(bool expr, const char *file, const char *line) { + if (!expr) { +#ifdef __DEBUG__ + kcout << "[KERNEL] Check Failed!\n"; + kcout << "[KERNEL] File: " << file << "\n"; + kcout << "[KERNEL] Where: " << line << "\n"; + +#endif // __DEBUG__ + + HCore::ke_stop(RUNTIME_CHECK_FAILED); // Runtime Check failed + } +} +} // namespace HCore diff --git a/Private/Source/RuntimeMain.cxx b/Private/Source/RuntimeMain.cxx index a2b777d8..6ae257bc 100644 --- a/Private/Source/RuntimeMain.cxx +++ b/Private/Source/RuntimeMain.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -17,17 +17,17 @@ extern "C" void (*__SYSTEM_FINI)(); extern "C" void (**__SYSTEM_INIT)(); extern "C" void RuntimeMain() { - for (hCore::SizeT index_init = 0UL; + for (HCore::SizeT index_init = 0UL; __SYSTEM_INIT[index_init] != __SYSTEM_FINI; ++index_init) { __SYSTEM_INIT[index_init](); } - MUST_PASS(hCore::init_hal()); + MUST_PASS(HCore::init_hal()); - hCore::IFilesystemManager::Mount(new hCore::NewFilesystemManager()); - hCore::PEFLoader img("/System/Seeker.cm"); + HCore::IFilesystemManager::Mount(new HCore::NewFilesystemManager()); + HCore::PEFLoader img("/System/Seeker.cm"); - if (!hCore::Utils::execute_from_image(img)) { - hCore::panic(RUNTIME_CHECK_BOOTSTRAP); + if (!HCore::Utils::execute_from_image(img)) { + HCore::ke_stop(RUNTIME_CHECK_BOOTSTRAP); } } diff --git a/Private/Source/SMPManager.cxx b/Private/Source/SMPManager.cxx index c261e6b8..9dd38d33 100644 --- a/Private/Source/SMPManager.cxx +++ b/Private/Source/SMPManager.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -13,10 +13,10 @@ /// BUGS: 0 -//! This file handles multi processing in hCore. +//! This file handles multi processing in HCore. //! Multi processing is needed for File I/O, networking and scheduling. -namespace hCore { +namespace HCore { // A ProcessorCore class takes care of it's owned hardware thread. // It has a stack for it's core. @@ -140,4 +140,4 @@ SMPManager::operator bool() noexcept { return !m_ThreadList.Empty(); } * @return */ bool SMPManager::operator!() noexcept { return m_ThreadList.Empty(); } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/Semaphore.cxx b/Private/Source/Semaphore.cxx index 5702b9fb..49ce2f40 100644 --- a/Private/Source/Semaphore.cxx +++ b/Private/Source/Semaphore.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,7 +11,7 @@ #include #include -namespace hCore { +namespace HCore { bool Semaphore::Unlock() noexcept { if (fLockingProcess) fLockingProcess = nullptr; @@ -41,4 +41,4 @@ void Semaphore::Sync() noexcept { while (fLockingProcess) { } } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/SharedObjectEntry.cxx b/Private/Source/SharedObjectEntry.cxx index 9fe14b39..c4d69be9 100644 --- a/Private/Source/SharedObjectEntry.cxx +++ b/Private/Source/SharedObjectEntry.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -14,7 +14,7 @@ #include #include -using namespace hCore; +using namespace HCore; /***********************************************************************************/ /// @file SharedObjectEntry.cxx diff --git a/Private/Source/Storage/ATA.cxx b/Private/Source/Storage/ATA.cxx index ed62df4f..18559526 100644 --- a/Private/Source/Storage/ATA.cxx +++ b/Private/Source/Storage/ATA.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -19,7 +19,7 @@ #define kATAError 2 -namespace hCore { +namespace HCore { Ref kPrdt = nullptr; bool set_prdt_struct(Ref& refCtrl) { @@ -95,4 +95,4 @@ Int32 ata_write_28(ULong lba, const char* text) { return packet[1] == 2 ? kATAError : 0; } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/Storage/NVME.cxx b/Private/Source/Storage/NVME.cxx index 9501b8fa..637162e9 100644 --- a/Private/Source/Storage/NVME.cxx +++ b/Private/Source/Storage/NVME.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -9,6 +9,6 @@ #include -namespace hCore { +namespace HCore { const char *NVMEDevice::Name() const { return ("NVMEDevice"); } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/Storage/Storage.cxx b/Private/Source/Storage/Storage.cxx index 2340763a..e39b13d8 100644 --- a/Private/Source/Storage/Storage.cxx +++ b/Private/Source/Storage/Storage.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/Source/Stream.cxx b/Private/Source/Stream.cxx index 598ad086..ba0b0145 100644 --- a/Private/Source/Stream.cxx +++ b/Private/Source/Stream.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== diff --git a/Private/Source/String.cxx b/Private/Source/String.cxx index b4f95f6c..da1e2e84 100644 --- a/Private/Source/String.cxx +++ b/Private/Source/String.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -10,7 +10,7 @@ #include #include -namespace hCore { +namespace HCore { Char *StringView::Data() { return m_Data; } const Char *StringView::CData() { return m_Data; } @@ -191,4 +191,4 @@ StringView &StringView::operator+=(const StringView &rhs) { return *this; } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/ThreadLocalStorage.cxx b/Private/Source/ThreadLocalStorage.cxx index 4e322e81..eee4f820 100644 --- a/Private/Source/ThreadLocalStorage.cxx +++ b/Private/Source/ThreadLocalStorage.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -15,7 +15,7 @@ /// @brief TLS implementation in kernel. /***********************************************************************************/ -using namespace hCore; +using namespace HCore; /** * Check for cookie inside TIB. @@ -34,7 +34,7 @@ Boolean hcore_tls_check(VoidPtr ptr) { } /** - * System call implementation in hCore + * System call implementation in HCore * @param ptr * @return */ diff --git a/Private/Source/Timer.cxx b/Private/Source/Timer.cxx index 137a5545..fdcf570d 100644 --- a/Private/Source/Timer.cxx +++ b/Private/Source/Timer.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,7 +11,7 @@ // bugs = 0 -using namespace hCore; +using namespace HCore; Int32 HardwareTimerInterface::Wait() noexcept { return H_UNIMPLEMENTED; } diff --git a/Private/Source/URL.cxx b/Private/Source/URL.cxx index 02a3ec77..cd676c30 100644 --- a/Private/Source/URL.cxx +++ b/Private/Source/URL.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -13,7 +13,7 @@ // Bugs = 0 -namespace hCore { +namespace HCore { Url::Url(StringView &strUrl) : m_urlView(strUrl, false) {} Url::~Url() = default; @@ -84,4 +84,4 @@ Ref> Url::Protocol() noexcept { return Ref>(loc); } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/UserHeap.cxx b/Private/Source/UserHeap.cxx index e748e315..9df475e7 100644 --- a/Private/Source/UserHeap.cxx +++ b/Private/Source/UserHeap.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -15,7 +15,7 @@ /// @note if you want to look at kernel allocs, please look for KHeap.cxx /// bugs: 0 -namespace hCore { +namespace HCore { class HeapManager final { public: static SizeT& GetCount() { return s_NumPools; } @@ -185,4 +185,4 @@ Boolean pool_ptr_exists(UIntPtr thePool, UIntPtr thePtr, SizeT theLimit) { return ((thePool) < (thePtr) < (theLimit)); } -} // namespace hCore +} // namespace HCore diff --git a/Private/Source/Utils.cxx b/Private/Source/Utils.cxx index 6569258b..3a3ba2a0 100644 --- a/Private/Source/Utils.cxx +++ b/Private/Source/Utils.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -9,7 +9,7 @@ #include -namespace hCore { +namespace HCore { Int string_compare(const Char *src, const Char *cmp, Size size) { Int32 counter = 0; @@ -163,12 +163,12 @@ char *string_from_char(char *str, const char chr) { return str; } -} // namespace hCore +} // namespace HCore extern "C" void memset(void *dst, char src, size_t len) { - hCore::rt_set_memory(dst, src, len); + HCore::rt_set_memory(dst, src, len); } extern "C" void memcpy(void *dst, void *src, size_t len) { - hCore::rt_copy_memory(src, dst, len); + HCore::rt_copy_memory(src, dst, len); } diff --git a/Private/Source/Variant.cxx b/Private/Source/Variant.cxx index cb1a9a01..a09c847c 100644 --- a/Private/Source/Variant.cxx +++ b/Private/Source/Variant.cxx @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -9,7 +9,7 @@ #include -namespace hCore { +namespace HCore { const Char* Variant::ToString() { if (m_Ptr == nullptr) { return ("Memory:{Nullptr}"); @@ -25,4 +25,4 @@ const Char* Variant::ToString() { } } -} // namespace hCore +} // namespace HCore diff --git a/Private/StorageKit/ATA.hpp b/Private/StorageKit/ATA.hpp index 76f06409..e357e441 100644 --- a/Private/StorageKit/ATA.hpp +++ b/Private/StorageKit/ATA.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * -* hCore +* HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -15,7 +15,7 @@ #include #include -namespace hCore +namespace HCore { enum class PATAType { @@ -101,4 +101,4 @@ namespace hCore } }; -} // namespace hCore +} // namespace HCore diff --git a/Private/StorageKit/NVME.hpp b/Private/StorageKit/NVME.hpp index 13f6131c..c669434d 100644 --- a/Private/StorageKit/NVME.hpp +++ b/Private/StorageKit/NVME.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -12,7 +12,7 @@ #include #include -namespace hCore +namespace HCore { class NVMEPacket; @@ -45,4 +45,4 @@ namespace hCore }; -} // namespace hCore +} // namespace HCore diff --git a/Private/StorageKit/PRDT.hpp b/Private/StorageKit/PRDT.hpp index 9522ccab..aa347939 100644 --- a/Private/StorageKit/PRDT.hpp +++ b/Private/StorageKit/PRDT.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -11,9 +11,9 @@ #include #include -#define PRDT_TRANSFER_SIZE (sizeof(hCore::UShort)) +#define PRDT_TRANSFER_SIZE (sizeof(HCore::UShort)) -namespace hCore { +namespace HCore { class PRDT final { public: PRDT() = delete; @@ -44,4 +44,4 @@ class PRDT final { }; using PhysicalAddress = PRDT; // here -} // namespace hCore +} // namespace HCore diff --git a/Private/StorageKit/Storage.hpp b/Private/StorageKit/Storage.hpp index 568a9d25..ee793af8 100644 --- a/Private/StorageKit/Storage.hpp +++ b/Private/StorageKit/Storage.hpp @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -13,7 +13,7 @@ #include #include -typedef hCore::UInt16 OSScsiPacket[12]; +typedef HCore::UInt16 OSScsiPacket[12]; extern const OSScsiPacket kCDRomPacketTemplate; diff --git a/Private/StorageKit/StorageCore.inl b/Private/StorageKit/StorageCore.inl index 73e89a9d..026fb26d 100644 --- a/Private/StorageKit/StorageCore.inl +++ b/Private/StorageKit/StorageCore.inl @@ -1,7 +1,7 @@ /* * ======================================================== * - * hCore + * HCore * Copyright 2024 Mahrouss Logic, all rights reserved. * * ======================================================== @@ -15,7 +15,7 @@ /// @file StorageCore.inl /// @brief Storage Management API. -namespace hCore { +namespace HCore { typedef Char* SKStr; ///! @brief Storage context, reads and write file according to the descriptor @@ -39,6 +39,6 @@ class StorageContext { PacketDescriptor* Read(const SKStr name); Int32 Write(PacketDescriptor* packet, const SKStr name); }; -} // namespace hCore +} // namespace HCore #endif /* ifndef __STORAGEKIT_STORAGECORE_INL__ */ diff --git a/Private/compile_flags.txt b/Private/compile_flags.txt new file mode 100644 index 00000000..bb35b987 --- /dev/null +++ b/Private/compile_flags.txt @@ -0,0 +1,4 @@ +-nostdlib +-ffreestanding +-std=c++20 +-I./ diff --git a/Private/makefile b/Private/makefile index b4245f03..9ac4a434 100644 --- a/Private/makefile +++ b/Private/makefile @@ -10,7 +10,7 @@ ASM = nasm ASMFLAGS = -f elf64 # This file is the kernel, responsible of task management, memory, drivers and more. -KERNEL = hKernel.efi +KERNEL = HCoreKrnl.efi # The kernel entrypoint SCRIPT = --script=Linker/Platforms/PC.lds @@ -20,7 +20,7 @@ FMT = elf64 .PHONY: invalid-recipe invalid-recipe: - @echo "invalid-recipe: Use make all instead." + @echo "[HCoreKrnl] invalid-recipe: Use make all instead." .PHONY: h-core h-core: @@ -42,7 +42,7 @@ link: .PHONY: all all: h-core link - @echo "[hKernel] HCore is linked." + @echo "[HCoreKrnl] HCore is linked." .PHONY: clean clean: diff --git a/Public/SDK/SystemKit/FileAPI.hxx b/Public/SDK/SystemKit/FileAPI.hxx index 12b57a41..c55d26ff 100644 --- a/Public/SDK/SystemKit/FileAPI.hxx +++ b/Public/SDK/SystemKit/FileAPI.hxx @@ -10,10 +10,10 @@ #ifndef _SYSTEM_KIT_HCORE_FILE_HPP #define _SYSTEM_KIT_HCORE_FILE_HPP -#include +#include #include -using namespace hCore; +using namespace HCore; class HFile final { public: diff --git a/Public/SDK/SystemKit/HeapAPI.hxx b/Public/SDK/SystemKit/HeapAPI.hxx index aa082ca6..11d4c265 100644 --- a/Public/SDK/SystemKit/HeapAPI.hxx +++ b/Public/SDK/SystemKit/HeapAPI.hxx @@ -9,10 +9,10 @@ #pragma once -#include +#include #include -using namespace hCore; +using namespace HCore; class HMemoryException; @@ -58,7 +58,7 @@ class HMemoryException final { const char *Reason(); private: - const char *mReason{"Memory error!"}; + const char *mReason{"HeapAPI: Memory Exception!"}; private: friend HHeap; diff --git a/Public/SDK/SystemKit/SystemKit.hxx b/Public/SDK/SystemKit/SystemKit.hxx index 9e1443cc..eca53757 100644 --- a/Public/SDK/SystemKit/SystemKit.hxx +++ b/Public/SDK/SystemKit/SystemKit.hxx @@ -9,4 +9,4 @@ #include #include -using namespace hCore; +using namespace HCore; diff --git a/Public/SDK/SystemKit/ThreadAPI.hxx b/Public/SDK/SystemKit/ThreadAPI.hxx index 24fc8507..a9490033 100644 --- a/Public/SDK/SystemKit/ThreadAPI.hxx +++ b/Public/SDK/SystemKit/ThreadAPI.hxx @@ -16,15 +16,15 @@ #include -namespace hCore { +namespace HCore { /// @brief Thread Information Block for Local Storage. /// Located in GS on AMD64, Virtual Address 0x10000 (64x0, 32x0, ARM64) struct ThreadInformationBlock final { - const Char TIB_NAME[255]; // Module Name - const UIntPtr TIB_START_CODE; // Start Address - const UIntPtr TIB_START_ALLOC; // Allocation Heap - const UIntPtr TIB_START_STACK; // Stack Pointer. - const Int32 TIB_ARCH; // Architecture and/or platform. + const Char NAME[255]; // Module Name + const UIntPtr START_ADDRESS; // Start Address + const UIntPtr START_ALLOC; // Allocation Heap + const UIntPtr START_STACK; // Stack Pointer. + const Int32 ARCH; // Architecture and/or platform. }; enum { @@ -34,6 +34,6 @@ enum { kMACS_64x0, kMACS_32x0, }; -} // namespace hCore +} // namespace HCore #endif // __THREAD_API__ diff --git a/Public/SDK/ZipKit/Defines.hpp b/Public/SDK/ZipKit/Defines.hpp index 053e3ad5..fc5e6068 100644 --- a/Public/SDK/ZipKit/Defines.hpp +++ b/Public/SDK/ZipKit/Defines.hpp @@ -12,6 +12,6 @@ #include #include -using namespace hCore; +using namespace HCore; #define ZIPKIT_VERSION "1.0.1" diff --git a/Public/SDK/ZipKit/Zip.hpp b/Public/SDK/ZipKit/Zip.hpp index 91ecde51..f0337ffa 100644 --- a/Public/SDK/ZipKit/Zip.hpp +++ b/Public/SDK/ZipKit/Zip.hpp @@ -11,7 +11,7 @@ #define Z_SOLO 1 -#include +#include #include #include diff --git a/Public/compile_flags.txt b/Public/compile_flags.txt new file mode 100644 index 00000000..21296223 --- /dev/null +++ b/Public/compile_flags.txt @@ -0,0 +1,5 @@ +-nostdlib +-ffreestanding +-std=c++20 +-I./SDK/ +-I../Private diff --git a/SPECIFICATION.TXT b/SPECIFICATION.TXT index 0b2238e7..fa3167eb 100644 --- a/SPECIFICATION.TXT +++ b/SPECIFICATION.TXT @@ -18,6 +18,7 @@ - Native Filesystem support (NewFS). - Program Loader. - TLS. +- Canary bird. - Dynamic Libraries. - Cross platform code (it has to work for each platform) -- cgit v1.2.3