diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-25 16:43:00 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-25 16:43:00 +0100 |
| commit | be29b406526c931a606d4d4de545f71e62bc893a (patch) | |
| tree | 99a37a287dda888803653df9e13cb1336150cb85 | |
| parent | f5e0bc85b06c84e0c6bc1da471630d02ff2ed7a3 (diff) | |
Kernel: A lot of preliminary changes before AHCI and SMP support.
32 files changed, 125 insertions, 156 deletions
diff --git a/Private/KernelKit/Rsrc/Splash.rsrc b/Private/Builtins/Toolbox/Rsrc/Splash.rsrc index 9b9a3e45..9b9a3e45 100644 --- a/Private/KernelKit/Rsrc/Splash.rsrc +++ b/Private/Builtins/Toolbox/Rsrc/Splash.rsrc diff --git a/Private/Builtins/Toolbox/Toolbox.hxx b/Private/Builtins/Toolbox/Toolbox.hxx index ca60c348..82d0f953 100644 --- a/Private/Builtins/Toolbox/Toolbox.hxx +++ b/Private/Builtins/Toolbox/Toolbox.hxx @@ -15,4 +15,4 @@ EXTERN_C HCore::Boolean _hal_left_button_pressed(); EXTERN_C HCore::Boolean _hal_middle_button_pressed(); EXTERN_C HCore::Boolean _hal_right_button_pressed(); -#include <KernelKit/Rsrc/Util.hxx> +#include <Builtins/Toolbox/Util.hxx> diff --git a/Private/KernelKit/Rsrc/Util.hxx b/Private/Builtins/Toolbox/Util.hxx index 2be185e1..2be185e1 100644 --- a/Private/KernelKit/Rsrc/Util.hxx +++ b/Private/Builtins/Toolbox/Util.hxx diff --git a/Private/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp b/Private/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp index 78b69bff..8039ce8a 100644 --- a/Private/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp +++ b/Private/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp @@ -11,7 +11,8 @@ EXTERN_C void idt_handle_gpf(HCore::UIntPtr rsp) { MUST_PASS(HCore::ProcessManager::Shared().Leak().GetCurrent()); - HCore::kcout << "NewKernel.exe: Stack Pointer: " << HCore::StringBuilder::FromInt("rsp{%}", rsp); + HCore::kcout << "NewKernel.exe: Stack Pointer: " + << HCore::StringBuilder::FromInt("rsp{%}", rsp); HCore::kcout << "NewKernel.exe: General Protection Fault, caused by " diff --git a/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp b/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp index d9161d17..fe38189e 100644 --- a/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp +++ b/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp @@ -93,7 +93,7 @@ struct MadtLocalApicAddressOverride final { STATIC MadtType kApicMadtList[256]; -MadtType* system_find_core(MadtType* madt) { +MadtType* _hal_system_find_core(MadtType* madt) { madt = madt + sizeof(MadtType); if (rt_string_cmp(madt->fMag, kApicSignature, @@ -112,12 +112,12 @@ void hal_system_get_cores(voidPtr rsdPtr) { MUST_PASS(kApicMadt); // MADT must exist. SizeT counter = 0UL; - MadtType* offset = system_find_core((MadtType*)kApicMadt); + MadtType* offset = _hal_system_find_core((MadtType*)kApicMadt); //! now find core addresses. while (offset != nullptr) { // calls rt_copy_memory in NewC++ kApicMadtList[counter] = *offset; - offset = system_find_core(offset); + offset = _hal_system_find_core(offset); ++counter; } diff --git a/Private/HALKit/AMD64/HalKernelMain.cxx b/Private/HALKit/AMD64/HalKernelMain.cxx index ca7ab158..266ef18a 100644 --- a/Private/HALKit/AMD64/HalKernelMain.cxx +++ b/Private/HALKit/AMD64/HalKernelMain.cxx @@ -5,6 +5,7 @@ ------------------------------------------- */ #include <ArchKit/ArchKit.hpp> +#include <Builtins/Toolbox/Rsrc/Splash.rsrc> #include <Builtins/Toolbox/Toolbox.hxx> #include <FirmwareKit/Handover.hxx> #include <KernelKit/FileManager.hpp> @@ -12,8 +13,6 @@ #include <KernelKit/KernelHeap.hpp> #include <KernelKit/PEFCodeManager.hxx> #include <KernelKit/ProcessScheduler.hpp> -#include <KernelKit/Rsrc/Splash.rsrc> -#include <KernelKit/Rsrc/Util.hxx> #include <KernelKit/UserHeap.hpp> #include <NewKit/Json.hpp> diff --git a/Private/HALKit/AMD64/HalKernelMouse.cxx b/Private/HALKit/AMD64/HalKernelMouse.cxx index 61e79845..0cbf47dc 100644 --- a/Private/HALKit/AMD64/HalKernelMouse.cxx +++ b/Private/HALKit/AMD64/HalKernelMouse.cxx @@ -5,9 +5,8 @@ ------------------------------------------- */ #include <Builtins/PS2/PS2MouseInterface.hxx> +#include <Builtins/Toolbox/Toolbox.hxx> #include <KernelKit/Framebuffer.hpp> -#include <KernelKit/Rsrc/Cursor.rsrc> -#include <KernelKit/Rsrc/Util.hxx> #include <NewKit/Defines.hpp> // forward decl. @@ -65,9 +64,15 @@ Void hal_handle_mouse() { /// @brief Interrupt handler for the mouse. EXTERN_C Void _hal_handle_mouse() { hal_handle_mouse(); } -EXTERN_C Boolean _hal_left_button_pressed() { return kMousePacket[0] & kPS2Leftbutton; } -EXTERN_C Boolean _hal_right_button_pressed() { return kMousePacket[0] & kPS2Rightbutton; } -EXTERN_C Boolean _hal_middle_button_pressed() { return kMousePacket[0] & kPS2Middlebutton; } +EXTERN_C Boolean _hal_left_button_pressed() { + return kMousePacket[0] & kPS2Leftbutton; +} +EXTERN_C Boolean _hal_right_button_pressed() { + return kMousePacket[0] & kPS2Rightbutton; +} +EXTERN_C Boolean _hal_middle_button_pressed() { + return kMousePacket[0] & kPS2Middlebutton; +} /// @brief Draws the kernel's mouse. EXTERN_C Boolean _hal_draw_mouse() { @@ -129,15 +134,7 @@ EXTERN_C Boolean _hal_draw_mouse() { if (kY > kHandoverHeader->f_GOP.f_Height - 16) kY = kHandoverHeader->f_GOP.f_Height - 16; - ToolboxInitRsrc(); - ToolboxClearZone(POINTER_HEIGHT, POINTER_WIDTH, kPrevX, kPrevY); - ToolboxDrawRsrc(Pointer, POINTER_HEIGHT, POINTER_WIDTH, kX, kY); - ToolboxClearRsrc(); - - HCore::kcout << number(kX); - HCore::kcout << "\r\n"; - HCore::kcout << number(kY); - HCore::kcout << "\r\n"; + /// Draw mouse here. kPrevX = kX; kPrevY = kY; @@ -147,9 +144,9 @@ EXTERN_C Boolean _hal_draw_mouse() { } /// @brief Init kernel mouse. -EXTERN_C Void _hal_init_mouse() { - kMousePS2.Init(); - +EXTERN_C Void _hal_init_mouse() { + kMousePS2.Init(); + HAL::Out8(0x21, 0b11111001); HAL::Out8(0xA1, 0b11101111); }
\ No newline at end of file diff --git a/Private/KernelKit/DriveManager.hxx b/Private/KernelKit/DriveManager.hxx index 40933aad..bec490d9 100644 --- a/Private/KernelKit/DriveManager.hxx +++ b/Private/KernelKit/DriveManager.hxx @@ -76,7 +76,7 @@ class MountpointInterface final { DriveDevicePtr C() { return mC; } DriveDevicePtr D() { return mD; } - DriveDevicePtr* GetAddressOf(int index) { + DriveDevicePtr* GetAddressOf(Int32 index) { DbgLastError() = kErrorSuccess; switch (index) { @@ -90,7 +90,7 @@ class MountpointInterface final { return &mD; default: { DbgLastError() = kErrorNoSuchDisk; - kcout << "NewKernel.exe: Check HError.\n"; + kcout << "NewKernel.exe: No such disk.\n"; break; } diff --git a/Private/KernelKit/Rsrc/Cursor.rsrc b/Private/KernelKit/Rsrc/Cursor.rsrc deleted file mode 100644 index 34366f96..00000000 --- a/Private/KernelKit/Rsrc/Cursor.rsrc +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#define POINTER_HEIGHT 32 -#define POINTER_WIDTH 32 - -// array size is 3072 -inline const unsigned int Pointer[] = { - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0xf7f7f7, 0xb6b6b6, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0xd5d5d5, 0xffffff, 0xa2a2a2, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x7a7a7a, 0xfefefe, 0xfafafa, 0x696969, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0xcacaca, 0xffffff, 0xe1e1e1, 0x272727, 0x767676, 0xececec, 0x878787, 0x000000, 0xf3f3f3, 0x909090, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x4a4a4a, 0xf3f3f3, 0xfefefe, 0xd5d5d5, 0x404040, 0xe2e2e2, 0xfbfbfb, 0xa1a1a1, 0xd5d5d5, 0xf9f9f9, 0x8c8c8c, 0xd9d9d9, 0x353535, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x9d9d9d, 0xfefefe, 0xfefefe, 0xf1f1f1, 0xdfdfdf, 0xfefefe, 0xfefefe, 0xf7f7f7, 0xfefefe, 0xeaeaea, 0xe5e5e5, 0xc8c8c8, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xdbdbdb, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfefefe, 0xfbfbfb, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x636363, 0xf8f8f8, 0xfdfdfd, 0xfdfdfd, 0xfdfdfd, 0xfdfdfd, 0xfdfdfd, 0xfdfdfd, 0xfdfdfd, 0xfdfdfd, 0xfdfdfd, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0xdbdbdb, 0xf9f9f9, 0xdfdfdf, 0xa5a5a5, 0x383838, 0xb0b0b0, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x9b9b9b, 0xd9d9d9, 0xfbfbfb, 0xfcfcfc, 0xf2f2f2, 0xb8b8b8, 0xececec, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x666666, 0xcacaca, 0xf9f9f9, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x666666, 0xe1e1e1, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x3b3b3b, 0xd9d9d9, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0xfbfbfb, 0xf9f9f9, 0xd6d6d6, 0x8e8e8e, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x525252, 0xc1c1c1, 0xcecece, 0xd6d6d6, 0xd1d1d1, 0xb5b5b5, 0x5d5d5d, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 -};
\ No newline at end of file diff --git a/Private/NewBoot/BootKit/BootKit.hxx b/Private/NewBoot/BootKit/BootKit.hxx index bad13d85..7012767c 100644 --- a/Private/NewBoot/BootKit/BootKit.hxx +++ b/Private/NewBoot/BootKit/BootKit.hxx @@ -205,4 +205,4 @@ class BVersionString final { static const CharacterTypeUTF16 *Shared() { return BOOTLOADER_VERSION; } }; -Void boot_try_write_partition_map(const Char* namePart, SizeT namePartLength, BDeviceATA* ataInterface); +Void boot_try_read_partition_map(const Char* namePart, SizeT namePartLength, BDeviceATA* ataInterface); diff --git a/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx b/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx index 36702198..da28a3f3 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx @@ -13,7 +13,7 @@ STATIC const BlockGUID kEPMGuid = { 0x425d, {0xbe, 0x7b, 0x75, 0xa3, 0x7c, 0xc6, 0x79, 0xbc}}; -Void boot_try_write_partition_map(const Char* namePart, SizeT namePartLength, +Void boot_try_read_partition_map(const Char* namePart, SizeT namePartLength, BDeviceATA* ataInterface) { if (namePartLength > kEPMNameLength || !namePart) return; if (!ataInterface) return; diff --git a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx index 1f0bbc9b..21481f85 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx @@ -47,7 +47,9 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle, if (ataDrv) { Char namePart[kEPMNameLength] = { "BootBlock" }; - boot_try_write_partition_map(namePart, kEPMNameLength, &ataDrv); + + /// tries to read an EPM block, or writes one if it fails. + boot_try_read_partition_map(namePart, kEPMNameLength, &ataDrv); } /// Read Kernel blob. diff --git a/Private/Source/KernelHeap.cxx b/Private/Source/KernelHeap.cxx index 09f62004..a38156f4 100644 --- a/Private/Source/KernelHeap.cxx +++ b/Private/Source/KernelHeap.cxx @@ -70,6 +70,8 @@ Int32 ke_delete_ke_heap(VoidPtr heapPtr) { (UIntPtr)heapPtr - sizeof(Detail::HeapInformationBlock)); if (virtualAddress && virtualAddress->hMagic == kHeapMagic) { + MUST_PASS(virtualAddress->hPresent); + if (virtualAddress->hCRC32 != 0) { if (virtualAddress->hCRC32 != ke_calculate_crc32((Char *)virtualAddress->hAddress, diff --git a/Private/Source/UserHeap.cxx b/Private/Source/UserHeap.cxx index 83d40845..45b29d51 100644 --- a/Private/Source/UserHeap.cxx +++ b/Private/Source/UserHeap.cxx @@ -18,9 +18,9 @@ namespace HCore { /** * @brief Process Heap Header - * @note Allocated per process, do not allocate twice! + * @note Allocated per process, it denotes the user's heap. */ -struct HeapHeader final { +struct UserHeapHeader final { UInt32 fMagic; Int32 fFlags; Boolean fFree; @@ -66,7 +66,7 @@ STATIC VoidPtr ke_find_unused_heap(Int flags) { !HeapManager::The()[index].Leak().Leak().Leak().Present()) { HeapManager::Leak().Leak().TogglePresent( HeapManager::The()[index].Leak().Leak(), true); - kcout << "[ke_find_unused_heap] Done, trying now to make a pool\r\n"; + kcout << "[ke_find_unused_heap] Done, trying to make a pool now...\r\n"; return ke_make_heap((VoidPtr)HeapManager::The()[index] .Leak() @@ -82,7 +82,7 @@ STATIC VoidPtr ke_find_unused_heap(Int flags) { STATIC VoidPtr ke_make_heap(VoidPtr virtualAddress, Int flags) { if (virtualAddress) { - HeapHeader* poolHdr = reinterpret_cast<HeapHeader*>(virtualAddress); + UserHeapHeader* poolHdr = reinterpret_cast<UserHeapHeader*>(virtualAddress); if (!poolHdr->fFree) { kcout << "[ke_make_heap] poolHdr->fFree, HeapPtr already exists\n"; @@ -95,7 +95,7 @@ STATIC VoidPtr ke_make_heap(VoidPtr virtualAddress, Int flags) { kcout << "[ke_make_heap] New allocation has been done.\n"; return reinterpret_cast<VoidPtr>( - (reinterpret_cast<UIntPtr>(virtualAddress) + sizeof(HeapHeader))); + (reinterpret_cast<UIntPtr>(virtualAddress) + sizeof(UserHeapHeader))); } kcout << "[ke_make_heap] Address is invalid"; @@ -103,10 +103,12 @@ STATIC VoidPtr ke_make_heap(VoidPtr virtualAddress, Int flags) { } STATIC Void ke_free_heap_internal(VoidPtr virtualAddress) { - HeapHeader* poolHdr = reinterpret_cast<HeapHeader*>( - reinterpret_cast<UIntPtr>(virtualAddress) - sizeof(HeapHeader)); + UserHeapHeader* poolHdr = reinterpret_cast<UserHeapHeader*>( + reinterpret_cast<UIntPtr>(virtualAddress) - sizeof(UserHeapHeader)); if (poolHdr->fMagic == kUserHeapMag) { + MUST_PASS(poolHdr->fFree); + poolHdr->fFree = false; poolHdr->fFlags = 0; diff --git a/Public/Documentation/SPECIFICATION.TXT b/Public/Documentation/SPECIFICATION.TXT index 11ee62e3..ce6c9893 100644 --- a/Public/Documentation/SPECIFICATION.TXT +++ b/Public/Documentation/SPECIFICATION.TXT @@ -7,7 +7,7 @@ - Language: C++/(Assembly (AMD64, X64000, X86S, ARM64)) =================================== -1: The HCore Microkernel +1: The NewKernel =================================== - Drive/Device Abstraction. @@ -42,7 +42,7 @@ - Hal -> hal_foo_bar =================================== -4: The HCore Bootloader +4: The NewBoot =================================== - Capable of booting from a network drive. diff --git a/Public/SDK/System.Core/Headers/Containers/ODF.hxx b/Public/SDK/System.Core/Headers/Containers/ODF.hxx deleted file mode 100644 index e0cb0bc1..00000000 --- a/Public/SDK/System.Core/Headers/Containers/ODF.hxx +++ /dev/null @@ -1,43 +0,0 @@ -/** =========================================== - (C) Mahrouss Logic - ===========================================*/ - -#ifndef __ODF__ -#define __ODF__ - -#include <System.Core/Headers/Defines.hxx> - -/** - * @brief Open Document Format - * @file ODF.hxx -*/ - -/// @brief four-character code for ODF. -#define kFourCCLength_ODF 4 - -/// @brief Document file header. -typedef struct ODFFileHeader -{ - CharacterTypeUTF8 f_Ident[kFourCCLength_ODF]; - - Int32Type f_DocumentKind; - Int32Type f_DocumentSize; - - Int64Type f_MetaForkOffset; - Int64Type f_DocumentForkOffset; - - CharacterTypeUTF8 f_Padding[4]; -} PACKED ODFFileHeader; - -/// @brief ODF Fork header -typedef struct ODFForkHeader -{ - CharacterTypeUTF8 f_MetadataName[255]; - - Int32Type f_MetadataKind; - Int32Type f_MetadataSize; - - CharacterTypeUTF8 f_Padding; -} PACKED ODFForkHeader; - -#endif // !__ODF__
\ No newline at end of file diff --git a/Public/SDK/System.Core/Headers/Defines.hxx b/Public/SDK/System.Core/Headers/Defines.hxx index 3cbf22fd..867dac76 100644 --- a/Public/SDK/System.Core/Headers/Defines.hxx +++ b/Public/SDK/System.Core/Headers/Defines.hxx @@ -247,4 +247,4 @@ typedef struct Object final { CA_EXTERN_C ObjectPtr HcGetInstanceObject(void); -CA_INLINE ObjectPtr kInstanceObject; +CA_INLINE ObjectPtr kApplicationObject; diff --git a/Public/SDK/System.Core/Headers/File.hxx b/Public/SDK/System.Core/Headers/File.hxx index f8efd75a..60c37cc6 100644 --- a/Public/SDK/System.Core/Headers/File.hxx +++ b/Public/SDK/System.Core/Headers/File.hxx @@ -29,12 +29,12 @@ enum { class FileInterface final { public: explicit FileInterface(const char *path) { - mHandle = kInstanceObject->Invoke(kInstanceObject, kProcessCallOpenHandle, + mHandle = kApplicationObject->Invoke(kApplicationObject, kProcessCallOpenHandle, 0, path); } ~FileInterface() { - kInstanceObject->Invoke(kInstanceObject, kProcessCallCloseHandle, 0, + kApplicationObject->Invoke(kApplicationObject, kProcessCallCloseHandle, 0, mHandle); } @@ -43,25 +43,25 @@ class FileInterface final { public: PtrVoidType Read(UIntPtrType off, SizeType sz) { - return (PtrVoidType)kInstanceObject->Invoke(kInstanceObject, mHandle, 2, + return (PtrVoidType)kApplicationObject->Invoke(kApplicationObject, mHandle, 2, off, sz); } PtrVoidType Read(SizeType sz) { - return (PtrVoidType)kInstanceObject->Invoke(kInstanceObject, mHandle, 3, + return (PtrVoidType)kApplicationObject->Invoke(kApplicationObject, mHandle, 3, sz); } void Write(PtrVoidType buf, UIntPtrType off, SizeType sz) { - kInstanceObject->Invoke(kInstanceObject, mHandle, 4, buf, off, sz); + kApplicationObject->Invoke(kApplicationObject, mHandle, 4, buf, off, sz); } void Write(PtrVoidType buf, SizeType sz) { - kInstanceObject->Invoke(kInstanceObject, mHandle, 5, buf, sz); + kApplicationObject->Invoke(kApplicationObject, mHandle, 5, buf, sz); } void Seek(UIntPtrType off) { - kInstanceObject->Invoke(kInstanceObject, mHandle, 5); + kApplicationObject->Invoke(kApplicationObject, mHandle, 5); } - void Rewind() { kInstanceObject->Invoke(kInstanceObject, mHandle, 6); } + void Rewind() { kApplicationObject->Invoke(kApplicationObject, mHandle, 6); } public: const char *MIME(); @@ -95,7 +95,7 @@ inline IntPtrType MakeSymlink(const char *from, const char *outputWhere) { CA_MUST_PASS(from); CA_MUST_PASS(outputWhere); - return kInstanceObject->Invoke(kInstanceObject, kProcessCallOpenHandle, 1, + return kApplicationObject->Invoke(kApplicationObject, kProcessCallOpenHandle, 1, from); } } // namespace System diff --git a/Public/SDK/System.Core/Headers/FormatManager/ODF.hxx b/Public/SDK/System.Core/Headers/FormatManager/ODF.hxx new file mode 100644 index 00000000..266726bf --- /dev/null +++ b/Public/SDK/System.Core/Headers/FormatManager/ODF.hxx @@ -0,0 +1,41 @@ +/** =========================================== + (C) Mahrouss Logic + ===========================================*/ + +#ifndef __ODF__ +#define __ODF__ + +#include <System.Core/Headers/Defines.hxx> + +/** + * @brief Open Document Format + * @file ODF.hxx + */ + +/// @brief four-character code for ODF. +#define kFourCCLength_ODF 4 + +/// @brief Document file header. +typedef struct ODFFileHeader { + CharacterTypeUTF8 f_Ident[kFourCCLength_ODF]; + + Int32Type f_DocumentKind; + Int32Type f_DocumentSize; + + Int64Type f_MetaForkOffset; + Int64Type f_DocumentForkOffset; + + CharacterTypeUTF8 f_Padding[4]; +} PACKED ODFFileHeader; + +/// @brief ODF Fork header +typedef struct ODFForkHeader { + CharacterTypeUTF8 f_MetadataName[255]; + + Int32Type f_MetadataKind; + Int32Type f_MetadataSize; + + CharacterTypeUTF8 f_Padding; +} PACKED ODFForkHeader; + +#endif // !__ODF__
\ No newline at end of file diff --git a/Public/SDK/System.Core/Headers/Containers/XIFF.hxx b/Public/SDK/System.Core/Headers/FormatManager/XIFF.hxx index 2531abce..2531abce 100644 --- a/Public/SDK/System.Core/Headers/Containers/XIFF.hxx +++ b/Public/SDK/System.Core/Headers/FormatManager/XIFF.hxx diff --git a/Public/SDK/System.Core/Headers/Heap.hxx b/Public/SDK/System.Core/Headers/Heap.hxx index 0d7103c5..06f5d38e 100644 --- a/Public/SDK/System.Core/Headers/Heap.hxx +++ b/Public/SDK/System.Core/Headers/Heap.hxx @@ -61,4 +61,17 @@ class HeapException : public SystemException { const char *mReason{"System.Core: HeapException: Catastrophic failure!"}; }; -} // namespace System
\ No newline at end of file +} // namespace System + +#define kAllocationTypes 2 + +enum HcAllocationKind { + kStandardAllocation = 0xC, + kArrayAllocation = 0xD, +}; + +CA_EXTERN_C PtrVoidType HcAllocateProcessHeap(ObjectPtr refObj, QWordType sz, + DWordType flags); +CA_EXTERN_C BooleanType HcProcessHeapExists(ObjectPtr refObj, PtrVoidType ptr); +CA_EXTERN_C QWordType HcProcessHeapSize(ObjectPtr refObj, PtrVoidType ptr); +CA_EXTERN_C VoidType HcFreeProcessHeap(ObjectPtr refObj, PtrVoidType ptr);
\ No newline at end of file diff --git a/Public/SDK/System.Core/Headers/UI/.gitkeep b/Public/SDK/System.Core/Headers/UI/.gitkeep deleted file mode 100644 index e69de29b..00000000 --- a/Public/SDK/System.Core/Headers/UI/.gitkeep +++ /dev/null diff --git a/Public/SDK/System.Core/Headers/UI/Dialog.hxx b/Public/SDK/System.Core/Headers/UIManager/Dialog.hxx index 2a02b434..2a02b434 100644 --- a/Public/SDK/System.Core/Headers/UI/Dialog.hxx +++ b/Public/SDK/System.Core/Headers/UIManager/Dialog.hxx diff --git a/Public/SDK/System.Core/Headers/UI/Imaging.hxx b/Public/SDK/System.Core/Headers/UIManager/Image.hxx index 2a02b434..2a02b434 100644 --- a/Public/SDK/System.Core/Headers/UI/Imaging.hxx +++ b/Public/SDK/System.Core/Headers/UIManager/Image.hxx diff --git a/Public/SDK/System.Core/Headers/UI/Menu.hxx b/Public/SDK/System.Core/Headers/UIManager/Menu.hxx index 2a02b434..2a02b434 100644 --- a/Public/SDK/System.Core/Headers/UI/Menu.hxx +++ b/Public/SDK/System.Core/Headers/UIManager/Menu.hxx diff --git a/Public/SDK/System.Core/Headers/UI/Rsrc.hxx b/Public/SDK/System.Core/Headers/UIManager/Rsrc.hxx index 2a02b434..2a02b434 100644 --- a/Public/SDK/System.Core/Headers/UI/Rsrc.hxx +++ b/Public/SDK/System.Core/Headers/UIManager/Rsrc.hxx diff --git a/Public/SDK/System.Core/Headers/UIManager/TrueType.hxx b/Public/SDK/System.Core/Headers/UIManager/TrueType.hxx new file mode 100644 index 00000000..62ed1255 --- /dev/null +++ b/Public/SDK/System.Core/Headers/UIManager/TrueType.hxx @@ -0,0 +1,7 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#pragma once diff --git a/Public/SDK/System.Core/Headers/UI/Window.hxx b/Public/SDK/System.Core/Headers/UIManager/Window.hxx index 2a02b434..2a02b434 100644 --- a/Public/SDK/System.Core/Headers/UI/Window.hxx +++ b/Public/SDK/System.Core/Headers/UIManager/Window.hxx diff --git a/Public/SDK/System.Core/Sources/Heap.cxx b/Public/SDK/System.Core/Sources/Heap.cxx index 3803af3a..18106f41 100644 --- a/Public/SDK/System.Core/Sources/Heap.cxx +++ b/Public/SDK/System.Core/Sources/Heap.cxx @@ -60,24 +60,24 @@ HeapInterface* HeapInterface::Shared() noexcept { } HeapInterface::HeapInterface() { - CA_MUST_PASS(HcProcessHeapExists(kInstanceObject, (PtrVoidType)this)); + CA_MUST_PASS(HcProcessHeapExists(kApplicationObject, (PtrVoidType)this)); } HeapInterface::~HeapInterface() { delete this; } void HeapInterface::Delete(PtrHeapType me) noexcept { CA_MUST_PASS(me); - HcFreeProcessHeap(kInstanceObject, me); + HcFreeProcessHeap(kApplicationObject, me); } SizeType HeapInterface::Size(PtrHeapType me) noexcept { CA_MUST_PASS(me); - return HcProcessHeapSize(kInstanceObject, me); + return HcProcessHeapSize(kApplicationObject, me); } PtrHeapType HeapInterface::New(const SizeType& sz, const DWordType flags) { SizeType _sz = sz; if (!_sz) ++_sz; - return HcAllocateProcessHeap(kInstanceObject, _sz, flags); + return HcAllocateProcessHeap(kApplicationObject, _sz, flags); } diff --git a/Public/SDK/System.Core/Sources/DllMain.cxx b/Public/SDK/System.Core/Sources/LibEntrypoint.cxx index 9412cbbb..b874ef55 100644 --- a/Public/SDK/System.Core/Sources/DllMain.cxx +++ b/Public/SDK/System.Core/Sources/LibEntrypoint.cxx @@ -7,8 +7,8 @@ /// @brief Inits the DLL. /// @return if it was succesful or not. DWordType __DllMain(VoidType) { - kInstanceObject = HcGetInstanceObject(); - CA_MUST_PASS(kInstanceObject); + kApplicationObject = HcGetInstanceObject(); + CA_MUST_PASS(kApplicationObject); return 0; }
\ No newline at end of file diff --git a/Public/SDK/System.Core/Sources/New+Delete.cxx b/Public/SDK/System.Core/Sources/New+Delete.cxx index fe8ed43f..678aacce 100644 --- a/Public/SDK/System.Core/Sources/New+Delete.cxx +++ b/Public/SDK/System.Core/Sources/New+Delete.cxx @@ -5,44 +5,32 @@ ------------------------------------------- */ #include <System.Core/Headers/Heap.hxx> - -#define kAllocationTypes 2 - -enum HcAllocationKind { - kStandardAllocation = 0xC, - kArrayAllocation = 0xD, -}; - -CA_EXTERN_C PtrVoidType HcAllocateProcessHeap(ObjectPtr refObj, QWordType sz, - DWordType flags); -CA_EXTERN_C BooleanType HcProcessHeapExists(ObjectPtr refObj, PtrVoidType ptr); -CA_EXTERN_C QWordType HcProcessHeapSize(ObjectPtr refObj, PtrVoidType ptr); -CA_EXTERN_C VoidType HcFreeProcessHeap(ObjectPtr refObj, PtrVoidType ptr); +#include <System.Core/Headers/Heap.hxx> typedef SizeType size_t; void* operator new[](size_t sz) { if (sz == 0) ++sz; - return HcAllocateProcessHeap(kInstanceObject, sz, kStandardAllocation); + return HcAllocateProcessHeap(kApplicationObject, sz, kStandardAllocation); } void* operator new(size_t sz) { if (sz == 0) ++sz; - return HcAllocateProcessHeap(kInstanceObject, sz, kArrayAllocation); + return HcAllocateProcessHeap(kApplicationObject, sz, kArrayAllocation); } void operator delete[](void* ptr) { if (ptr == nullptr) return; - HcFreeProcessHeap(kInstanceObject, ptr); + HcFreeProcessHeap(kApplicationObject, ptr); } void operator delete(void* ptr) { if (ptr == nullptr) return; - HcFreeProcessHeap(kInstanceObject, ptr); + HcFreeProcessHeap(kApplicationObject, ptr); } void operator delete(void* ptr, size_t sz) { @@ -50,5 +38,5 @@ void operator delete(void* ptr, size_t sz) { (void)sz; - HcFreeProcessHeap(kInstanceObject, ptr); + HcFreeProcessHeap(kApplicationObject, ptr); } diff --git a/Public/Servers/.gitkeep b/Public/Servers/.gitkeep deleted file mode 100644 index e69de29b..00000000 --- a/Public/Servers/.gitkeep +++ /dev/null |
