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 /Private | |
| parent | f5e0bc85b06c84e0c6bc1da471630d02ff2ed7a3 (diff) | |
Kernel: A lot of preliminary changes before AHCI and SMP support.
Diffstat (limited to 'Private')
| -rw-r--r-- | Private/Builtins/Toolbox/Rsrc/Splash.rsrc (renamed from Private/KernelKit/Rsrc/Splash.rsrc) | 0 | ||||
| -rw-r--r-- | Private/Builtins/Toolbox/Toolbox.hxx | 2 | ||||
| -rw-r--r-- | Private/Builtins/Toolbox/Util.hxx (renamed from Private/KernelKit/Rsrc/Util.hxx) | 0 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cpp | 3 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp | 6 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalKernelMain.cxx | 3 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalKernelMouse.cxx | 31 | ||||
| -rw-r--r-- | Private/KernelKit/DriveManager.hxx | 4 | ||||
| -rw-r--r-- | Private/KernelKit/Rsrc/Cursor.rsrc | 40 | ||||
| -rw-r--r-- | Private/NewBoot/BootKit/BootKit.hxx | 2 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx | 2 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootMain.cxx | 4 | ||||
| -rw-r--r-- | Private/Source/KernelHeap.cxx | 2 | ||||
| -rw-r--r-- | Private/Source/UserHeap.cxx | 16 |
14 files changed, 39 insertions, 76 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; |
