summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-30 17:59:15 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-30 17:59:15 +0100
commit1be243700efc9e36060c5fb65c951d5db6b98e94 (patch)
tree2f57d5092f4de4798e80e80b6dd29f984edb7683
parent1d3bed385c9666db5b1803ee8e02a2c4fdcc9f29 (diff)
Add ROADMAP details, add EFI Library for bootloader.
Add assignee to code in MailMap. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
-rw-r--r--MailMap2
-rw-r--r--Private/ArchKit/Arch.hpp2
-rw-r--r--Private/EFIKit/EFI.hxx8
-rw-r--r--Private/EFIKit/EFILib.hxx53
-rw-r--r--Private/EFIKit/UEFI.hxx10
-rw-r--r--Private/HALKit/AMD64/HardwareInit.cpp2
-rw-r--r--Private/HALKit/AXP/CR.s (renamed from Private/HALKit/Alpha/CR.s)0
-rw-r--r--Private/HALKit/AXP/CoreInterruptHandlerDEC.cpp (renamed from Private/HALKit/Alpha/CoreInterruptHandlerDEC.cpp)0
-rw-r--r--Private/HALKit/AXP/CoreSyscallHandlerDEC.cpp (renamed from Private/HALKit/Alpha/CoreSyscallHandlerDEC.cpp)0
-rw-r--r--Private/HALKit/AXP/HAL.s (renamed from Private/HALKit/Alpha/HAL.s)0
-rw-r--r--Private/HALKit/AXP/Processor.hpp (renamed from Private/HALKit/Alpha/Processor.hpp)0
-rw-r--r--Private/HALKit/AXP/README (renamed from Private/HALKit/Alpha/README)0
-rw-r--r--Private/HALKit/AXP/README.TXT1
-rw-r--r--Private/HALKit/AXP/SYSCALL.s (renamed from Private/HALKit/Alpha/SYSCALL.s)0
-rw-r--r--Private/HALKit/AXP/VM.s (renamed from Private/HALKit/Alpha/VM.s)0
-rw-r--r--Private/HALKit/PowerPC/Processor.cpp2
-rw-r--r--Private/NewBoot/BootKit/BootKit.hxx (renamed from Private/NewBoot/BootKit/Boot.hxx)0
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/BootKit.cxx (renamed from Private/NewBoot/Source/HEL/AMD64/Boot.cxx)2
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx25
-rw-r--r--Private/NewKit/KernelHeap.hpp5
-rw-r--r--Private/NewKit/UserHeap.hpp39
-rw-r--r--Private/NewKit/Utils.hpp8
-rw-r--r--Private/Source/CodeManager.cxx4
-rw-r--r--Private/Source/KernelHeap.cxx13
-rw-r--r--Private/Source/New+Delete.cxx10
-rw-r--r--Private/Source/PageManager.cxx2
-rw-r--r--Private/Source/ProcessManager.cxx10
-rw-r--r--Private/Source/RuntimeMain.cxx7
-rw-r--r--Private/Source/URL.cxx2
-rw-r--r--Private/Source/UserHeap.cxx24
-rw-r--r--Private/Source/Utils.cxx8
-rw-r--r--TODO_LIST.TXT9
32 files changed, 157 insertions, 91 deletions
diff --git a/MailMap b/MailMap
index 1a345d53..126cdd13 100644
--- a/MailMap
+++ b/MailMap
@@ -1 +1 @@
-amlel - amlalelmahrouss@icloud.com, amlal@mahrouss.com +33 6 58 57 30 14
+amlel - Microkernel,Bootloader - amlalelmahrouss@icloud.com, +33 6 58 57 30 14
diff --git a/Private/ArchKit/Arch.hpp b/Private/ArchKit/Arch.hpp
index 4cfa5e0e..b2ae36bc 100644
--- a/Private/ArchKit/Arch.hpp
+++ b/Private/ArchKit/Arch.hpp
@@ -71,7 +71,7 @@ namespace HCore
return hash;
}
- bool init_hal();
+ bool ke_init_hal();
} // namespace HCore
#define kMaxSyscalls 0x100
diff --git a/Private/EFIKit/EFI.hxx b/Private/EFIKit/EFI.hxx
index 969b42b2..febed042 100644
--- a/Private/EFIKit/EFI.hxx
+++ b/Private/EFIKit/EFI.hxx
@@ -11,12 +11,11 @@
#define __EFI__
/**
-@brief HCore Implementation of UEFI protocols.
+@brief HCore Implementation of EFI.
@author Amlal El Mahrouss
*/
#include <NewKit/Defines.hpp>
-#include <cstdint>
using namespace HCore;
@@ -30,11 +29,12 @@ struct EfiBootServices;
struct EfiMemoryDescriptor;
struct EfiSystemTable;
-// Types
-
+/// @brief Core Handle Type
+/// This is like NT's Win32 HANDLE type.
typedef struct {
} *EfiHandlePtr;
+/* UEFI uses wide characters by default. */
typedef WideChar EfiCharType;
/// What's BootBolicy?
diff --git a/Private/EFIKit/EFILib.hxx b/Private/EFIKit/EFILib.hxx
new file mode 100644
index 00000000..6925d89c
--- /dev/null
+++ b/Private/EFIKit/EFILib.hxx
@@ -0,0 +1,53 @@
+/*
+ * ========================================================
+ *
+ * h-core
+ * Copyright 2024, Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#ifndef __EFI_LIB__
+#define __EFI_LIB__
+
+#include <EFIKit/EFI.hxx>
+
+inline EfiSystemTable* ST = nullptr;
+inline EfiBootServices* BS = nullptr;
+
+namespace Detail {
+/**
+@brief Stop Execution of Bootloader.
+@param SystemTable EFI System Table.
+*/
+Void Stop(EfiSystemTable* SystemTable) noexcept {
+ while (true) {
+ rt_cli();
+ rt_halt();
+ }
+}
+} // namespace Detail
+
+inline void KeInitEFI(EfiSystemTable* SystemTable) noexcept {
+ ST = SystemTable;
+ BS = ST->BootServices;
+}
+
+inline void KeRuntimeStop(const EfiCharType* File,
+ const EfiCharType* Reason) noexcept {
+ ST->ConOut->OutputString(ST->ConOut, L"*** STOP ***\r\n");
+
+ ST->ConOut->OutputString(ST->ConOut, L"*** File:");
+ ST->ConOut->OutputString(ST->ConOut, File);
+ ST->ConOut->OutputString(ST->ConOut, L", Reason:");
+ ST->ConOut->OutputString(ST->ConOut, Reason);
+ ST->ConOut->OutputString(ST->ConOut, L" ***\r\n");
+
+ Detail::Stop(ST);
+}
+
+#ifdef __BOOTLOADER__
+#include <BootKit/Processor.hxx>
+#endif // IF TARGET=BOOTLOADER
+
+#endif /* ifndef __EFI_LIB__ */
diff --git a/Private/EFIKit/UEFI.hxx b/Private/EFIKit/UEFI.hxx
new file mode 100644
index 00000000..aeee81cb
--- /dev/null
+++ b/Private/EFIKit/UEFI.hxx
@@ -0,0 +1,10 @@
+/*
+ * ========================================================
+ *
+ * h-core
+ * Copyright 2024, Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#include <EFIKit/EFI.hxx>
diff --git a/Private/HALKit/AMD64/HardwareInit.cpp b/Private/HALKit/AMD64/HardwareInit.cpp
index db84226b..1856cc2d 100644
--- a/Private/HALKit/AMD64/HardwareInit.cpp
+++ b/Private/HALKit/AMD64/HardwareInit.cpp
@@ -12,7 +12,7 @@
// bugs = 0
namespace HCore {
-bool init_hal() {
+bool ke_init_hal() {
// TODO: Hardware Specific stuff.
return true;
diff --git a/Private/HALKit/Alpha/CR.s b/Private/HALKit/AXP/CR.s
index b01dc619..b01dc619 100644
--- a/Private/HALKit/Alpha/CR.s
+++ b/Private/HALKit/AXP/CR.s
diff --git a/Private/HALKit/Alpha/CoreInterruptHandlerDEC.cpp b/Private/HALKit/AXP/CoreInterruptHandlerDEC.cpp
index e69de29b..e69de29b 100644
--- a/Private/HALKit/Alpha/CoreInterruptHandlerDEC.cpp
+++ b/Private/HALKit/AXP/CoreInterruptHandlerDEC.cpp
diff --git a/Private/HALKit/Alpha/CoreSyscallHandlerDEC.cpp b/Private/HALKit/AXP/CoreSyscallHandlerDEC.cpp
index 0881f9c6..0881f9c6 100644
--- a/Private/HALKit/Alpha/CoreSyscallHandlerDEC.cpp
+++ b/Private/HALKit/AXP/CoreSyscallHandlerDEC.cpp
diff --git a/Private/HALKit/Alpha/HAL.s b/Private/HALKit/AXP/HAL.s
index 46127130..46127130 100644
--- a/Private/HALKit/Alpha/HAL.s
+++ b/Private/HALKit/AXP/HAL.s
diff --git a/Private/HALKit/Alpha/Processor.hpp b/Private/HALKit/AXP/Processor.hpp
index e6a00db3..e6a00db3 100644
--- a/Private/HALKit/Alpha/Processor.hpp
+++ b/Private/HALKit/AXP/Processor.hpp
diff --git a/Private/HALKit/Alpha/README b/Private/HALKit/AXP/README
index 91e7b134..91e7b134 100644
--- a/Private/HALKit/Alpha/README
+++ b/Private/HALKit/AXP/README
diff --git a/Private/HALKit/AXP/README.TXT b/Private/HALKit/AXP/README.TXT
new file mode 100644
index 00000000..03c2b816
--- /dev/null
+++ b/Private/HALKit/AXP/README.TXT
@@ -0,0 +1 @@
+A Toy HAL to test the Kernel portability.
diff --git a/Private/HALKit/Alpha/SYSCALL.s b/Private/HALKit/AXP/SYSCALL.s
index 19cab808..19cab808 100644
--- a/Private/HALKit/Alpha/SYSCALL.s
+++ b/Private/HALKit/AXP/SYSCALL.s
diff --git a/Private/HALKit/Alpha/VM.s b/Private/HALKit/AXP/VM.s
index d8d7aa71..d8d7aa71 100644
--- a/Private/HALKit/Alpha/VM.s
+++ b/Private/HALKit/AXP/VM.s
diff --git a/Private/HALKit/PowerPC/Processor.cpp b/Private/HALKit/PowerPC/Processor.cpp
index 9ac0953e..04676eff 100644
--- a/Private/HALKit/PowerPC/Processor.cpp
+++ b/Private/HALKit/PowerPC/Processor.cpp
@@ -30,7 +30,7 @@ void rt_wakeup_thread(HAL::StackFrame* stack) {}
void rt_hang_thread(HAL::StackFrame* stack) {}
// @brief main HAL entrypoint
-void init_hal() {}
+void ke_init_hal() {}
void system_io_print(const char* bytes) {
if (!bytes) return;
diff --git a/Private/NewBoot/BootKit/Boot.hxx b/Private/NewBoot/BootKit/BootKit.hxx
index 70607a9c..70607a9c 100644
--- a/Private/NewBoot/BootKit/Boot.hxx
+++ b/Private/NewBoot/BootKit/BootKit.hxx
diff --git a/Private/NewBoot/Source/HEL/AMD64/Boot.cxx b/Private/NewBoot/Source/HEL/AMD64/BootKit.cxx
index b3ff2206..68971e0c 100644
--- a/Private/NewBoot/Source/HEL/AMD64/Boot.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/BootKit.cxx
@@ -7,7 +7,7 @@
* ========================================================
*/
-#include <BootKit/Boot.hxx>
+#include <BootKit/BootKit.hxx>
constexpr HCore::UInt32 kVGABaseAddress = 0xb8000;
diff --git a/Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx b/Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx
index f155311f..b3e63bd9 100644
--- a/Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx
@@ -7,39 +7,28 @@
* ========================================================
*/
-#include <BootKit/Boot.hxx>
+#define __BOOTLOADER__ 1
-namespace Detail {
-/**
-@brief Stop Execution of Bootloader.
-@param SystemTable EFI System Table.
-*/
-Void Stop(EfiSystemTable* SystemTable) noexcept {
- SystemTable->ConOut->OutputString(SystemTable->ConOut,
- L"HCoreLdr: Hanging...\r\n");
-
- while (true) {
- rt_cli();
- rt_halt();
- }
-}
-} // namespace Detail
+#include <BootKit/BootKit.hxx>
+#include <EFIKit/EFILib.hxx>
// don't remove EfiGUID, it will call initializer_list!
EFI_EXTERN_C int EfiMain(EfiHandlePtr ImageHandle,
EfiSystemTable* SystemTable) {
+ KeInitEFI(SystemTable);
+
SystemTable->ConOut->OutputString(SystemTable->ConOut,
L"HCoreLdr: Initializing...\r\n");
EfiLoadImageProtocol* protocol = nullptr;
EfiGUID guid = EFI_LOADED_IMAGE_PROTOCOL_GUID;
- Int32 status_code = SystemTable->BootServices->OpenProtocol(
+ Int32 statusCode = SystemTable->BootServices->OpenProtocol(
ImageHandle, &guid, (VoidPtr*)&protocol, ImageHandle, nullptr,
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
- if (status_code != kEfiOk) {
+ if (statusCode != kEfiOk) {
SystemTable->ConOut->OutputString(
SystemTable->ConOut,
L"HCoreLdr: Could not locate EfiLoadImageProtocol! Aborting...\r\n");
diff --git a/Private/NewKit/KernelHeap.hpp b/Private/NewKit/KernelHeap.hpp
index 85e916d3..f45e81aa 100644
--- a/Private/NewKit/KernelHeap.hpp
+++ b/Private/NewKit/KernelHeap.hpp
@@ -17,6 +17,7 @@
#include <NewKit/Pmm.hpp>
namespace HCore {
-Int32 kernel_delete_ptr(voidPtr allocatedPtr);
-voidPtr kernel_new_ptr(const SizeT &sz, const bool rw, const bool user);
+Void ke_init_ke_heap() noexcept;
+Int32 ke_delete_ke_heap(voidPtr allocatedPtr);
+voidPtr ke_new_ke_heap(const SizeT &sz, const bool rw, const bool user);
} // namespace HCore
diff --git a/Private/NewKit/UserHeap.hpp b/Private/NewKit/UserHeap.hpp
index 63a65528..eac9d7d5 100644
--- a/Private/NewKit/UserHeap.hpp
+++ b/Private/NewKit/UserHeap.hpp
@@ -21,27 +21,24 @@
// description: memory pool for user programs.
#define kPoolMaxSz 4096
-#define kPoolMag 0x5500A1
+#define kPoolMag 0x5500A1
-namespace HCore
-{
- enum
- {
- kPoolHypervisor = 0x2,
- kPoolShared = 0x4,
- kPoolUser = 0x6,
- kPoolRw = 0x8,
- };
+namespace HCore {
+enum {
+ kPoolHypervisor = 0x2,
+ kPoolShared = 0x4,
+ kPoolUser = 0x6,
+ kPoolRw = 0x8,
+};
- struct HeapHeader final
- {
- UInt32 Magic;
- Int32 Flags;
- Boolean Free;
- UIntPtr Pad;
- };
+struct HeapHeader final {
+ UInt32 Magic;
+ Int32 Flags;
+ Boolean Free;
+ UIntPtr Pad;
+};
- VoidPtr pool_new_ptr(Int32 flags);
- Int32 pool_free_ptr(voidPtr pointer);
- Boolean pool_ptr_exists(UIntPtr thePool, UIntPtr thePtr, SizeT theLimit);
-} // namespace HCore
+Void ke_init_heap();
+VoidPtr ke_new_heap(Int32 flags);
+Int32 ke_free_heap(voidPtr pointer);
+} // namespace HCore
diff --git a/Private/NewKit/Utils.hpp b/Private/NewKit/Utils.hpp
index 02dcd00a..42d3ca70 100644
--- a/Private/NewKit/Utils.hpp
+++ b/Private/NewKit/Utils.hpp
@@ -25,8 +25,8 @@ namespace HCore
Boolean to_str(Char *buf, Int limit, Int base);
Boolean is_newln(Char chr);
Boolean is_space(Char chr);
- Int to_uppercase(Int c);
- Int to_lower(Int c);
- voidPtr string_in_string(const char* in, const char* needle);
- char* string_from_char(char* str, const char chr);
+ Int rt_to_uppercase(Int c);
+ Int rt_to_lower(Int c);
+ voidPtr rt_string_in_string(const char* in, const char* needle);
+ char* rt_string_from_char(char* str, const char chr);
} // namespace HCore
diff --git a/Private/Source/CodeManager.cxx b/Private/Source/CodeManager.cxx
index 364a94f6..911aefd3 100644
--- a/Private/Source/CodeManager.cxx
+++ b/Private/Source/CodeManager.cxx
@@ -57,7 +57,7 @@ PEFLoader::PEFLoader(const char *path) : fCachedBlob(nullptr), fBad(false) {
"started!\n";
fBad = true;
- kernel_delete_ptr(fCachedBlob);
+ ke_delete_ke_heap(fCachedBlob);
fCachedBlob = nullptr;
};
@@ -78,7 +78,7 @@ PEFLoader::PEFLoader(const char *path) : fCachedBlob(nullptr), fBad(false) {
}
PEFLoader::~PEFLoader() {
- if (fCachedBlob) kernel_delete_ptr(fCachedBlob);
+ if (fCachedBlob) ke_delete_ke_heap(fCachedBlob);
}
VoidPtr PEFLoader::FindSymbol(const char *name, Int32 kind) {
diff --git a/Private/Source/KernelHeap.cxx b/Private/Source/KernelHeap.cxx
index 94e9156c..3e61a733 100644
--- a/Private/Source/KernelHeap.cxx
+++ b/Private/Source/KernelHeap.cxx
@@ -40,7 +40,7 @@ static voidPtr find_ptr(const SizeT &sz, const bool rw, const bool user) {
/// @param rw read write (true to enable it)
/// @param user is it accesible by user processes?
/// @return the pointer
-VoidPtr kernel_new_ptr(const SizeT &sz, const bool rw, const bool user) {
+VoidPtr ke_new_ke_heap(const SizeT &sz, const bool rw, const bool user) {
if (kWrapperCount < sz) return nullptr;
if (auto ptr = Detail::find_ptr(sz, rw, user); ptr) return ptr;
@@ -62,7 +62,7 @@ VoidPtr kernel_new_ptr(const SizeT &sz, const bool rw, const bool user) {
/// @brief Declare pointer as free.
/// @param ptr the pointer.
/// @return
-Int32 kernel_delete_ptr(voidPtr ptr) {
+Int32 ke_delete_ke_heap(voidPtr ptr) {
if (ptr) {
const UIntPtr virtualAddress = reinterpret_cast<UIntPtr>(ptr);
@@ -106,4 +106,13 @@ Boolean kernel_valid_ptr(voidPtr ptr) {
return false;
}
+
+/// @brief The Kernel heap initializer function.
+/// @return
+Void ke_init_ke_heap() noexcept
+{
+ kWrapperCount = 0UL;
+ Ref<PTEWrapper *> kLastWrapper = Ref<PTEWrapper*>(nullptr);
+ Pmm kPmm = Pmm();
+}
} // namespace HCore
diff --git a/Private/Source/New+Delete.cxx b/Private/Source/New+Delete.cxx
index e4dba396..274258a4 100644
--- a/Private/Source/New+Delete.cxx
+++ b/Private/Source/New+Delete.cxx
@@ -15,7 +15,7 @@ void* operator new[](size_t sz)
if (sz == 0)
++sz;
- return HCore::kernel_new_ptr(sz, true, false);
+ return HCore::ke_new_ke_heap(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::ke_new_ke_heap(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::ke_delete_ke_heap(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::ke_delete_ke_heap(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::ke_delete_ke_heap(ptr);
}
diff --git a/Private/Source/PageManager.cxx b/Private/Source/PageManager.cxx
index 95300bd9..8ae083a3 100644
--- a/Private/Source/PageManager.cxx
+++ b/Private/Source/PageManager.cxx
@@ -65,7 +65,7 @@ PTEWrapper *PageManager::Request(Boolean Rw, Boolean User,
HCore::HAL::hal_alloc_page(sizeof(PTEWrapper), Rw, User));
if (PageTableEntry == nullptr) {
- kcout << "PTEWrapper : Page table is nullptr!, kernel_new_ptr failed!";
+ kcout << "PTEWrapper : Page table is nullptr!, ke_new_ke_heap failed!";
return nullptr;
}
diff --git a/Private/Source/ProcessManager.cxx b/Private/Source/ProcessManager.cxx
index 9d1792a2..404e05e6 100644
--- a/Private/Source/ProcessManager.cxx
+++ b/Private/Source/ProcessManager.cxx
@@ -132,7 +132,7 @@ void Process::Exit(Int32 exit_code) {
if (this->Ring != (Int32)ProcessSelector::kRingDriver &&
this->Ring != (Int32)ProcessSelector::kRingKernel) {
- pool_free_ptr(this->Pool);
+ ke_free_heap(this->Pool);
this->PoolCursor = nullptr;
@@ -141,9 +141,9 @@ void Process::Exit(Int32 exit_code) {
}
//! Delete image if not done already.
- if (this->Image) kernel_delete_ptr(this->Image);
+ if (this->Image) ke_delete_ke_heap(this->Image);
- if (this->StackFrame) kernel_delete_ptr((VoidPtr)this->StackFrame);
+ if (this->StackFrame) ke_delete_ke_heap((VoidPtr)this->StackFrame);
ProcessManager::Shared().Leak().Remove(this->ProcessId);
}
@@ -153,12 +153,12 @@ bool ProcessManager::Add(Ref<Process> &process) {
kcout << "ProcessManager::Add(Ref<Process>& process)\r\n";
- process.Leak().Pool = pool_new_ptr(kPoolUser | kPoolRw);
+ process.Leak().Pool = ke_new_heap(kPoolUser | kPoolRw);
process.Leak().ProcessId = this->m_Headers.Count();
process.Leak().PoolCursor = process.Leak().Pool;
process.Leak().StackFrame = reinterpret_cast<HAL::StackFrame *>(
- kernel_new_ptr(sizeof(HAL::StackFrame), true, false));
+ ke_new_ke_heap(sizeof(HAL::StackFrame), true, false));
MUST_PASS(process.Leak().StackFrame);
diff --git a/Private/Source/RuntimeMain.cxx b/Private/Source/RuntimeMain.cxx
index 6ae257bc..94a483c5 100644
--- a/Private/Source/RuntimeMain.cxx
+++ b/Private/Source/RuntimeMain.cxx
@@ -11,6 +11,8 @@
#include <KernelKit/CodeManager.hpp>
#include <KernelKit/FileManager.hpp>
#include <NewKit/Json.hpp>
+#include <NewKit/KernelHeap.hpp>
+#include <NewKit/UserHeap.hpp>
/// PRIVATE SYMBOLS EXPORTED BY GCC.
extern "C" void (*__SYSTEM_FINI)();
@@ -22,7 +24,10 @@ extern "C" void RuntimeMain() {
__SYSTEM_INIT[index_init]();
}
- MUST_PASS(HCore::init_hal());
+ MUST_PASS(HCore::ke_init_hal());
+
+ HCore::ke_init_heap();
+ HCore::ke_init_ke_heap();
HCore::IFilesystemManager::Mount(new HCore::NewFilesystemManager());
HCore::PEFLoader img("/System/Seeker.cm");
diff --git a/Private/Source/URL.cxx b/Private/Source/URL.cxx
index cd676c30..f242dd32 100644
--- a/Private/Source/URL.cxx
+++ b/Private/Source/URL.cxx
@@ -43,7 +43,7 @@ static ErrorOr<StringView> url_extract_location(const char *url) {
for (; i < string_length(url); ++i) {
if (!scheme_found) {
for (int y = 0; kProtosCount; ++y) {
- if (string_in_string(view.CData(), kProtos[y])) {
+ if (rt_string_in_string(view.CData(), kProtos[y])) {
i += string_length(kProtos[y]) + kUrlOutSz;
scheme_found = true;
diff --git a/Private/Source/UserHeap.cxx b/Private/Source/UserHeap.cxx
index 9df475e7..b34e123e 100644
--- a/Private/Source/UserHeap.cxx
+++ b/Private/Source/UserHeap.cxx
@@ -124,7 +124,7 @@ static bool ke_check_and_free_heap(const SizeT& index, voidPtr ptr) {
/// @brief Creates a new pool pointer.
/// @param flags the flags attached to it.
/// @return a pool pointer with selected permissions.
-voidPtr pool_new_ptr(Int32 flags) {
+voidPtr ke_new_heap(Int32 flags) {
if (!HeapManager::IsEnabled()) return nullptr;
if (HeapManager::GetCount() > kPoolMaxSz) return nullptr;
@@ -140,7 +140,7 @@ voidPtr pool_new_ptr(Int32 flags) {
auto& ref = HeapManager::GetCount();
++ref; // increment the number of addresses we have now.
- kcout << "[pool_new_ptr] New Address found!\r\n";
+ kcout << "[ke_new_heap] New Address found!\r\n";
// finally make the pool address.
return ke_make_heap(
@@ -153,7 +153,7 @@ voidPtr pool_new_ptr(Int32 flags) {
/// @brief free a pool pointer.
/// @param ptr The pool pointer to free.
/// @return status code
-Int32 pool_free_ptr(voidPtr ptr) {
+Int32 ke_free_heap(voidPtr ptr) {
if (!HeapManager::IsEnabled()) return -1;
if (ptr) {
@@ -171,18 +171,10 @@ Int32 pool_free_ptr(voidPtr ptr) {
return -1;
}
-/// @brief Checks if pointer is valid.
-/// @param thePool the pool pointer.
-/// @param thePtr the pointer.
-/// @param theLimit the last address of the pool.
-/// @return if it is valid.
-Boolean pool_ptr_exists(UIntPtr thePool, UIntPtr thePtr, SizeT theLimit) {
- if (HeapManager::GetCount() < 1) return false;
-
- if (thePool == 0 || thePtr == 0 || theLimit == 0) {
- return false;
- }
-
- return ((thePool) < (thePtr) < (theLimit));
+/// @brief Init HeapManager, set GetCount to zero and IsEnabled to true.
+/// @return
+Void ke_init_heap() {
+ HeapManager::GetCount() = 0UL;
+ HeapManager::IsEnabled() = true;
}
} // namespace HCore
diff --git a/Private/Source/Utils.cxx b/Private/Source/Utils.cxx
index 3a3ba2a0..7c61ec96 100644
--- a/Private/Source/Utils.cxx
+++ b/Private/Source/Utils.cxx
@@ -107,13 +107,13 @@ const Char *alloc_string(const Char *text) {
return string;
}
-Int to_uppercase(Int character) {
+Int rt_to_uppercase(Int character) {
if (character >= 'a' && character <= 'z') return character - 0x20;
return character;
}
-Int to_lower(Int character) {
+Int rt_to_lower(Int character) {
if (character >= 'A' && character <= 'Z') return character + 0x20;
return character;
@@ -143,7 +143,7 @@ Boolean is_space(Char chr) { return chr == ' '; }
Boolean is_newln(Char chr) { return chr == '\n'; }
-voidPtr string_in_string(const char *in, const char *needle) {
+voidPtr rt_string_in_string(const char *in, const char *needle) {
for (size_t i = 0; i < string_length(in); ++i) {
if (string_compare(in + i, needle, string_length(needle)) == 0)
return reinterpret_cast<voidPtr>(const_cast<char *>(in + i));
@@ -154,7 +154,7 @@ voidPtr string_in_string(const char *in, const char *needle) {
// @brief Checks for a string start at the character.
-char *string_from_char(char *str, const char chr) {
+char *rt_string_from_char(char *str, const char chr) {
while (*str != chr) {
++str;
diff --git a/TODO_LIST.TXT b/TODO_LIST.TXT
index 7479344e..b89c0659 100644
--- a/TODO_LIST.TXT
+++ b/TODO_LIST.TXT
@@ -9,3 +9,12 @@
- Context switch x87/SSE/AVX registers [ ]
- Framebuffer and ATA support [ ]
- Native Subsystem and GUI [ ]
+
+Status:
+
+HCoreLdr: Working.
+HCoreKrnl: Not run yet.
+
+Prioritize:
+HCoreLdr: Protocol and API.
+HCoreKrnl: Complying to specs.