summaryrefslogtreecommitdiffhomepage
path: root/Private
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-23 21:40:37 +0100
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-23 21:40:37 +0100
commit09383c793fe953da6441902b4f66b1382df46738 (patch)
tree9c4e4040ad28818c6f13c96375221609cfc773a5 /Private
parentd9477b8a80ee0dc9a6d05c0353aa989ceaedae8a (diff)
Kernel: See below.
Fix BUG inside ATA driver: Due to bad cast on lba select. Add ToolBox APIs for kernel GUI. Userland: See below. Worked a bit on System.Core, just wrapped Thread.hxx into the System namespace. Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private')
-rw-r--r--Private/Builtins/ATA/Defines.hxx4
-rw-r--r--Private/Builtins/PS2/PS2MouseInterface.hxx35
-rw-r--r--Private/Builtins/Toolbox/Toolbox.hxx20
-rw-r--r--Private/HALKit/AMD64/HalInterruptRouting.asm21
-rw-r--r--Private/HALKit/AMD64/HalKernelMain.cxx33
-rw-r--r--Private/HALKit/AMD64/HalKernelMouse.cxx144
-rw-r--r--Private/HALKit/AMD64/Processor.hpp2
-rw-r--r--Private/HALKit/AMD64/Storage/ATA.cxx20
-rw-r--r--Private/KernelKit/Rsrc/Cursor.rsrc2
-rw-r--r--Private/KernelKit/Rsrc/Util.hxx18
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/BootATA.cxx16
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/BootMain.cxx4
-rw-r--r--Private/NewBoot/Source/makefile2
-rw-r--r--Private/Source/ProcessScheduler.cxx2
-rw-r--r--Private/Source/ProcessTeam.cxx5
15 files changed, 183 insertions, 145 deletions
diff --git a/Private/Builtins/ATA/Defines.hxx b/Private/Builtins/ATA/Defines.hxx
index f0f019e8..01b67c42 100644
--- a/Private/Builtins/ATA/Defines.hxx
+++ b/Private/Builtins/ATA/Defines.hxx
@@ -136,10 +136,10 @@ HCore::Void drv_ata_select(HCore::UInt16 Bus);
HCore::Boolean drv_ata_wait_io(HCore::UInt16 IO);
-HCore::Void drv_ata_read(HCore::UInt32 Lba, HCore::UInt16 IO, HCore::UInt8 Master, HCore::Char* Buf,
+HCore::Void drv_ata_read(HCore::UInt64 Lba, HCore::UInt16 IO, HCore::UInt8 Master, HCore::Char* Buf,
HCore::SizeT SectorSz, HCore::SizeT Size);
-HCore::Void drv_ata_write(HCore::UInt32 Lba, HCore::UInt16 IO, HCore::UInt8 Master, HCore::Char* Buf,
+HCore::Void drv_ata_write(HCore::UInt64 Lba, HCore::UInt16 IO, HCore::UInt8 Master, HCore::Char* Buf,
HCore::SizeT SectorSz, HCore::SizeT Size);
#endif // ifdef __KERNEL__ \ No newline at end of file
diff --git a/Private/Builtins/PS2/PS2MouseInterface.hxx b/Private/Builtins/PS2/PS2MouseInterface.hxx
index beb98665..5e964962 100644
--- a/Private/Builtins/PS2/PS2MouseInterface.hxx
+++ b/Private/Builtins/PS2/PS2MouseInterface.hxx
@@ -27,39 +27,30 @@ class PS2MouseInterface final {
HCORE_COPY_DEFAULT(PS2MouseInterface);
public:
+ /// @brief Enables PS2 mouse for kernel.
+ /// @return
Void Init() noexcept {
HAL::rt_cli();
- HCore::kcout << "HCoreKrnl.exe: Enabling PS/2 mouse...\r\n";
-
- this->Write(0xFF);
-
- HAL::Out8(0x64, 0xA8);
+ HAL::Out8(0x64, 0xA8); // enabling the auxiliary device - mouse
this->Wait();
-
- HAL::Out8(0x64, 0x20);
-
+ HAL::Out8(0x64, 0x20); // tells the keyboard controller that we want to send a command to the mouse
this->WaitInput();
-
- UInt8 dataStatus = HAL::In8(0x60);
-
- dataStatus |= 0b10;
+
+ UInt8 status = HAL::In8(0x60);
+ status |= 0b10;
this->Wait();
-
- HAL::Out8(0x60, dataStatus);
+ HAL::Out8(0x64, 0x60);
+ this->Wait();
+ HAL::Out8(0x60, status); // setting the correct bit is the "compaq" status byte
this->Write(0xF6);
- auto f6Dat = this->Read();
+ this->Read();
this->Write(0xF4);
- auto f4Dat = this->Read();
-
- HCore::kcout << "HCoreKrnl.exe: PS/2 mouse is OK: " << hex_number(f6Dat);
- HCore::kcout << ", " << hex_number(f4Dat) << end_line();
-
- HAL::Out8(0x64, 0xAD);
+ this->Read();
HAL::rt_sti();
}
@@ -69,7 +60,7 @@ class PS2MouseInterface final {
UInt64 timeout = 100000;
while (timeout) {
- if ((HAL::In8(0x64) & 0x1) == 0x0) {
+ if ((HAL::In8(0x64) & 0x1)) {
HCore::kcout << "NewKernel.exe: Wait: OK\r\n";
return true;
}
diff --git a/Private/Builtins/Toolbox/Toolbox.hxx b/Private/Builtins/Toolbox/Toolbox.hxx
new file mode 100644
index 00000000..f349375b
--- /dev/null
+++ b/Private/Builtins/Toolbox/Toolbox.hxx
@@ -0,0 +1,20 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#pragma once
+
+#include <NewKit/Defines.hpp>
+
+EXTERN_C HCore::Void _hal_init_mouse();
+EXTERN_C HCore::Boolean _hal_draw_mouse();
+EXTERN_C HCore::Void _hal_handle_mouse();
+EXTERN_C HCore::Boolean _hal_left_button_pressed();
+EXTERN_C HCore::Boolean _hal_middle_button_pressed();
+EXTERN_C HCore::Boolean _hal_right_button_pressed();
+
+#define TOOLBOX_LOOP() while (true)
+
+#include <KernelKit/Rsrc/Util.hxx>
diff --git a/Private/HALKit/AMD64/HalInterruptRouting.asm b/Private/HALKit/AMD64/HalInterruptRouting.asm
index 06e40161..c00ce375 100644
--- a/Private/HALKit/AMD64/HalInterruptRouting.asm
+++ b/Private/HALKit/AMD64/HalInterruptRouting.asm
@@ -105,16 +105,10 @@ IntExp 30
IntNormal 31
-;; Mapped according to PIC remap.
-__HCR_INT_32:
- push rax
-
- call _hal_handle_mouse
-
- pop rax
- iretq
+IntNormal 32
IntNormal 33
+
IntNormal 34
IntNormal 35
IntNormal 36
@@ -124,11 +118,8 @@ IntNormal 39
IntNormal 40
IntNormal 41
IntNormal 42
-
IntNormal 43
-
IntNormal 44
-
IntNormal 45
IntNormal 46
IntNormal 47
@@ -168,10 +159,10 @@ IntNormal 60
;; this one is doing a POST for us.
;; testing interrupts.
_ke_power_on_self_test:
- int 50
- int 50
- int 50
- int 50
+ int 0x32
+ int 0x32
+ int 0x32
+ int 0x32
ret
diff --git a/Private/HALKit/AMD64/HalKernelMain.cxx b/Private/HALKit/AMD64/HalKernelMain.cxx
index 5ceb57bd..90a09556 100644
--- a/Private/HALKit/AMD64/HalKernelMain.cxx
+++ b/Private/HALKit/AMD64/HalKernelMain.cxx
@@ -5,6 +5,7 @@
------------------------------------------- */
#include <ArchKit/ArchKit.hpp>
+#include <Builtins/Toolbox/Toolbox.hxx>
#include <FirmwareKit/Handover.hxx>
#include <KernelKit/FileManager.hpp>
#include <KernelKit/Framebuffer.hpp>
@@ -19,10 +20,6 @@
///! @brief Disk contains HCore files.
#define kInstalledMedia 0xDD
-EXTERN_C HCore::Void _hal_init_mouse();
-EXTERN_C HCore::Void _hal_draw_mouse();
-EXTERN_C HCore::Void _hal_handle_mouse();
-
EXTERN_C HCore::VoidPtr kInterruptVectorTable[];
EXTERN_C void RuntimeMain(
@@ -31,9 +28,9 @@ EXTERN_C void RuntimeMain(
/// Setup kernel globals.
kKernelVirtualSize = HandoverHeader->f_VirtualSize;
- kKernelVirtualStart =
- reinterpret_cast<HCore::VoidPtr>(reinterpret_cast<HCore::UIntPtr>(
- HandoverHeader->f_VirtualStart) + kVirtualAddressStartOffset);
+ kKernelVirtualStart = reinterpret_cast<HCore::VoidPtr>(
+ reinterpret_cast<HCore::UIntPtr>(HandoverHeader->f_VirtualStart) +
+ kVirtualAddressStartOffset);
kKernelPhysicalSize = HandoverHeader->f_PhysicalSize;
kKernelPhysicalStart = HandoverHeader->f_PhysicalStart;
@@ -66,14 +63,6 @@ EXTERN_C void RuntimeMain(
HCore::HAL::IDTLoader idt;
idt.Load(idtBase);
- KeInitRsrc();
-
- KeDrawRsrc(MahroussLogic, MAHROUSSLOGIC_HEIGHT, MAHROUSSLOGIC_WIDTH,
- ((kHandoverHeader->f_GOP.f_Width - MAHROUSSLOGIC_WIDTH) / 2),
- ((kHandoverHeader->f_GOP.f_Height - MAHROUSSLOGIC_HEIGHT) / 2));
-
- KeClearRsrc();
-
/// START POST
HCore::HAL::Detail::_ke_power_on_self_test();
@@ -86,14 +75,20 @@ EXTERN_C void RuntimeMain(
/// We already have an install of HCore.
if (HandoverHeader->f_Bootloader == kInstalledMedia) {
- /// TODO: Parse system configuration.
+ ToolboxInitRsrc();
+
+ ToolboxDrawRsrc(MahroussLogic, MAHROUSSLOGIC_HEIGHT, MAHROUSSLOGIC_WIDTH,
+ ((kHandoverHeader->f_GOP.f_Width - MAHROUSSLOGIC_WIDTH) / 2),
+ ((kHandoverHeader->f_GOP.f_Height - MAHROUSSLOGIC_HEIGHT) / 2));
+
+ ToolboxClearRsrc();
} else {
/// TODO: Install hcore on host.
_hal_init_mouse();
- while (true) {
- _hal_draw_mouse();
- }
+ ToolboxDrawZone(kClearClr, kHandoverHeader->f_GOP.f_Height, kHandoverHeader->f_GOP.f_Width, 0, 0);
+
+ TOOLBOX_LOOP() { _hal_draw_mouse(); }
}
HCore::ke_stop(RUNTIME_CHECK_BOOTSTRAP);
diff --git a/Private/HALKit/AMD64/HalKernelMouse.cxx b/Private/HALKit/AMD64/HalKernelMouse.cxx
index 2033badc..61e79845 100644
--- a/Private/HALKit/AMD64/HalKernelMouse.cxx
+++ b/Private/HALKit/AMD64/HalKernelMouse.cxx
@@ -11,22 +11,21 @@
#include <NewKit/Defines.hpp>
// forward decl.
-EXTERN_C HCore::Void _hal_draw_mouse();
+EXTERN_C HCore::Boolean _hal_draw_mouse();
EXTERN_C HCore::Void _hal_init_mouse();
-STATIC HCore::Int32 kPrevX = 0;
-STATIC HCore::Int32 kPrevY = 0;
-STATIC HCore::Int32 kX = 0;
-STATIC HCore::Int32 kY = 0;
+STATIC HCore::Int32 kPrevX = 10;
+STATIC HCore::Int32 kPrevY = 10;
+STATIC HCore::Int32 kX = 10;
+STATIC HCore::Int32 kY = 10;
STATIC HCore::Int32 kMouseCycle = 0;
STATIC HCore::PS2MouseInterface kMousePS2;
-STATIC HCore::Int32 kMousePacket[4];
+STATIC HCore::Char kMousePacket[4] = {};
STATIC HCore::Boolean kMousePacketReady = false;
-#define kPS2LeftButton 0b00000001
-#define kPS2MiddleButton 0b00000010
-#define kPS2RightButton 0b00000100
-
+#define kPS2Leftbutton 0b00000001
+#define kPS2Middlebutton 0b00000010
+#define kPS2Rightbutton 0b00000100
#define kPS2XSign 0b00010000
#define kPS2YSign 0b00100000
#define kPS2XOverflow 0b01000000
@@ -38,84 +37,119 @@ Void hal_handle_mouse() {
HCore::UInt8 data = HAL::In8(0x60);
switch (kMouseCycle) {
- case 0: {
+ case 0:
if (kMousePacketReady) break;
- if ((data & 0b00001000) == 0) break;
-
+ if (data & 0b00001000 == 0) break;
kMousePacket[0] = data;
- ++kMouseCycle;
-
+ kMouseCycle++;
break;
- }
- case 1: {
+ case 1:
if (kMousePacketReady) break;
-
kMousePacket[1] = data;
- ++kMouseCycle;
-
+ kMouseCycle++;
break;
- }
- case 2: {
+ case 2:
if (kMousePacketReady) break;
-
kMousePacket[2] = data;
-
kMousePacketReady = true;
kMouseCycle = 0;
-
- break;
- }
- default:
break;
}
// Notify PIC controller that we're done with it's interrupt.
- HCore::HAL::Out8(0xA0, 0x20);
HCore::HAL::Out8(0x20, 0x20);
+ HCore::HAL::Out8(0xA0, 0x20);
}
/// @brief Interrupt handler for the mouse.
EXTERN_C Void _hal_handle_mouse() { hal_handle_mouse(); }
-/// @brief Draws the kernel's mouse.
-EXTERN_C Void _hal_draw_mouse() {
- if (!kMousePacketReady) return;
-
- bool xNeg, yNeg, xOvf, yOvf;
-
- xNeg = (kMousePacket[0] & kPS2XSign);
- yNeg = (kMousePacket[0] & kPS2YSign);
+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; }
- xOvf = (kMousePacket[0] & kPS2XOverflow);
- yOvf = (kMousePacket[0] & kPS2YOverflow);
-
- kX = !xNeg ? (256 + kMousePacket[1]) : (256 - (-kMousePacket[1]));
- kY = !yNeg ? (256 + kMousePacket[2]) : (256 - (-kMousePacket[2]));
-
- if (kY > kHandoverHeader->f_GOP.f_Height) {
- kY = 0;
- return;
+/// @brief Draws the kernel's mouse.
+EXTERN_C Boolean _hal_draw_mouse() {
+ if (!kMousePacketReady) return false;
+
+ bool xNegative, yNegative, xOverflow, yOverflow;
+
+ if (kMousePacket[0] & kPS2XSign) {
+ xNegative = true;
+ } else
+ xNegative = false;
+
+ if (kMousePacket[0] & kPS2YSign) {
+ yNegative = true;
+ } else
+ yNegative = false;
+
+ if (kMousePacket[0] & kPS2XOverflow) {
+ xOverflow = true;
+ } else
+ xOverflow = false;
+
+ if (kMousePacket[0] & kPS2YOverflow) {
+ yOverflow = true;
+ } else
+ yOverflow = false;
+
+ if (!xNegative) {
+ kX += kMousePacket[1];
+ if (xOverflow) {
+ kX += 255;
+ }
+ } else {
+ kMousePacket[1] = 256 - kMousePacket[1];
+ kX -= kMousePacket[1];
+ if (xOverflow) {
+ kX -= 255;
+ }
}
- if (kX > kHandoverHeader->f_GOP.f_Width) {
- kX = 0;
- return;
+ if (!yNegative) {
+ kY -= kMousePacket[2];
+ if (yOverflow) {
+ kY -= 255;
+ }
+ } else {
+ kMousePacket[2] = 256 - kMousePacket[2];
+ kY += kMousePacket[2];
+ if (yOverflow) {
+ kY += 255;
+ }
}
- KeClearZone(POINTER_HEIGHT, POINTER_WIDTH, kPrevX, kPrevY);
+ if (kX < 0) kX = 0;
+ if (kX > kHandoverHeader->f_GOP.f_Width - 8)
+ kX = kHandoverHeader->f_GOP.f_Width - 8;
+
+ if (kY < 0) kY = 0;
+ 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();
- KeInitRsrc();
- KeDrawRsrc(Pointer, POINTER_HEIGHT, POINTER_WIDTH, kX, kY);
- KeClearRsrc();
+ HCore::kcout << number(kX);
+ HCore::kcout << "\r\n";
+ HCore::kcout << number(kY);
+ HCore::kcout << "\r\n";
kPrevX = kX;
kPrevY = kY;
kMousePacketReady = false;
+ return true;
}
/// @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/HALKit/AMD64/Processor.hpp b/Private/HALKit/AMD64/Processor.hpp
index bbda5edc..4e104b40 100644
--- a/Private/HALKit/AMD64/Processor.hpp
+++ b/Private/HALKit/AMD64/Processor.hpp
@@ -183,4 +183,4 @@ EXTERN_C void hal_load_gdt(HCore::HAL::RegisterGDT ptr);
/// @brief Maximum size of the IDT.
#define kKernelIdtSize 0x100
-#define kKernelInterruptId 50
+#define kKernelInterruptId 0x32
diff --git a/Private/HALKit/AMD64/Storage/ATA.cxx b/Private/HALKit/AMD64/Storage/ATA.cxx
index 854b166e..699876b7 100644
--- a/Private/HALKit/AMD64/Storage/ATA.cxx
+++ b/Private/HALKit/AMD64/Storage/ATA.cxx
@@ -18,8 +18,6 @@
#include <Builtins/ATA/Defines.hxx>
#include <ArchKit/ArchKit.hpp>
-#ifdef __KERNEL__
-
using namespace HCore;
using namespace HCore::HAL;
@@ -130,16 +128,16 @@ ATAInit_Retry:
return true;
}
-Void drv_ata_read(UInt32 Lba, UInt16 IO, UInt8 Master, Char* Buf,
+Void drv_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf,
SizeT SectorSz, SizeT Size) {
UInt8 Command = (!Master ? 0xE0 : 0xF0);
Out8(IO + ATA_REG_HDDEVSEL, (Command) | (((Lba) >> 24) & 0xF));
Out8(IO + ATA_REG_SEC_COUNT0, SectorSz);
- Out8(IO + ATA_REG_LBA0, (UInt8)(Lba));
- Out8(IO + ATA_REG_LBA1, (UInt8)(Lba) >> 8);
- Out8(IO + ATA_REG_LBA2, (UInt8)(Lba) >> 16);
+ Out8(IO + ATA_REG_LBA0, (Lba));
+ Out8(IO + ATA_REG_LBA1, (Lba) >> 8);
+ Out8(IO + ATA_REG_LBA2, (Lba) >> 16);
Out8(IO + ATA_REG_COMMAND, ATA_CMD_READ_PIO);
@@ -152,16 +150,16 @@ Void drv_ata_read(UInt32 Lba, UInt16 IO, UInt8 Master, Char* Buf,
}
}
-Void drv_ata_write(UInt32 Lba, UInt16 IO, UInt8 Master, Char* Buf,
+Void drv_ata_write(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf,
SizeT SectorSz, SizeT Size) {
UInt8 Command = (!Master ? 0xE0 : 0xF0);
Out8(IO + ATA_REG_HDDEVSEL, (Command) | (((Lba) >> 24) & 0xF));
Out8(IO + ATA_REG_SEC_COUNT0, SectorSz);
- Out8(IO + ATA_REG_LBA0, (UInt8)(Lba));
- Out8(IO + ATA_REG_LBA1, (UInt8)(Lba) >> 8);
- Out8(IO + ATA_REG_LBA2, (UInt8)(Lba) >> 16);
+ Out8(IO + ATA_REG_LBA0, (Lba));
+ Out8(IO + ATA_REG_LBA1, (Lba) >> 8);
+ Out8(IO + ATA_REG_LBA2, (Lba) >> 16);
Out8(IO + ATA_REG_COMMAND, ATA_CMD_WRITE_PIO);
@@ -175,5 +173,3 @@ Void drv_ata_write(UInt32 Lba, UInt16 IO, UInt8 Master, Char* Buf,
/// @check is ATA detected?
Boolean drv_ata_detected(Void) { return kATADetected; }
-
-#endif // ifdef __KERNEL__
diff --git a/Private/KernelKit/Rsrc/Cursor.rsrc b/Private/KernelKit/Rsrc/Cursor.rsrc
index 94922ca7..34366f96 100644
--- a/Private/KernelKit/Rsrc/Cursor.rsrc
+++ b/Private/KernelKit/Rsrc/Cursor.rsrc
@@ -4,7 +4,7 @@
#define POINTER_WIDTH 32
// array size is 3072
-static const unsigned int Pointer[] = {
+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,
diff --git a/Private/KernelKit/Rsrc/Util.hxx b/Private/KernelKit/Rsrc/Util.hxx
index bf753055..ccca0c97 100644
--- a/Private/KernelKit/Rsrc/Util.hxx
+++ b/Private/KernelKit/Rsrc/Util.hxx
@@ -4,12 +4,14 @@
// Last Rev
// Sat Feb 24 CET 2024
-#define KeInitRsrc() HCore::SizeT uA = 0
+#define ToolboxInitRsrc() HCore::SizeT uA = 0
-#define KeClearRsrc() uA = 0
+#define kClearClr RGB(26, 67, B3)
+
+#define ToolboxClearRsrc() uA = 0
/// @brief draws a resource.
-#define KeDrawRsrc(ImgPtr, _Height, _Width, BaseX, BaseY) \
+#define ToolboxDrawRsrc(ImgPtr, _Height, _Width, BaseX, BaseY) \
uA = 0; \
\
for (HCore::SizeT i = BaseX; i < _Height + BaseX; ++i) { \
@@ -36,7 +38,7 @@
/// @brief cleans a resource.
-#define KeClearZone(_Height, _Width, BaseX, BaseY) \
+#define ToolboxClearZone(_Height, _Width, BaseX, BaseY) \
\
for (HCore::SizeT i = BaseX; i < _Height + BaseX; ++i) { \
for (HCore::SizeT u = BaseY; u < _Width + BaseY; ++u) { \
@@ -45,15 +47,15 @@
kHandoverHeader->f_GOP \
.f_PixelPerLine * \
i + \
- 4 * u))) = RGB(0, 0, 0); \
+ 4 * u))) = kClearClr; \
} \
}
-#define KeDrawZone(_Clr, _Height, _Width, BaseX, BaseY) \
+#define ToolboxDrawZone(_Clr, _Height, _Width, BaseX, BaseY) \
\
- for (HCore::SizeT i = BaseX; i < _Height + BaseX; ++i) { \
- for (HCore::SizeT u = BaseY; u < _Width + BaseY; ++u) { \
+ for (HCore::SizeT i = BaseX; i < _Width + BaseX; ++i) { \
+ for (HCore::SizeT u = BaseY; u < _Height + BaseY; ++u) { \
*(((volatile HCore::UInt32*)(kHandoverHeader->f_GOP.f_The + \
4 * \
kHandoverHeader->f_GOP \
diff --git a/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx b/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx
index 110bdf08..50bab4b7 100644
--- a/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx
@@ -131,7 +131,7 @@ ATAInit_Retry:
return true;
}
-Void boot_ata_read(UInt32 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf,
+Void boot_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf,
SizeT SectorSz, SizeT Size) {
UInt8 Command = (!Master ? 0xE0 : 0xF0);
@@ -140,9 +140,9 @@ Void boot_ata_read(UInt32 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf,
Out8(IO + ATA_REG_HDDEVSEL, (Command) | (((Lba) >> 24) & 0xF));
Out8(IO + ATA_REG_SEC_COUNT0, SectorSz);
- Out8(IO + ATA_REG_LBA0, (UInt8)(Lba));
- Out8(IO + ATA_REG_LBA1, (UInt8)(Lba) >> 8);
- Out8(IO + ATA_REG_LBA2, (UInt8)(Lba) >> 16);
+ Out8(IO + ATA_REG_LBA0, (Lba));
+ Out8(IO + ATA_REG_LBA1, (Lba) >> 8);
+ Out8(IO + ATA_REG_LBA2, (Lba) >> 16);
Out8(IO + ATA_REG_COMMAND, ATA_CMD_READ_PIO);
@@ -164,7 +164,7 @@ Void boot_ata_read(UInt32 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf,
}
}
-Void boot_ata_write(UInt32 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf,
+Void boot_ata_write(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf,
SizeT SectorSz, SizeT Size) {
UInt8 Command = (!Master ? 0xE0 : 0xF0);
@@ -173,9 +173,9 @@ Void boot_ata_write(UInt32 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf,
Out8(IO + ATA_REG_HDDEVSEL, (Command) | (((Lba) >> 24) & 0xF));
Out8(IO + ATA_REG_SEC_COUNT0, SectorSz);
- Out8(IO + ATA_REG_LBA0, (UInt8)(Lba));
- Out8(IO + ATA_REG_LBA1, (UInt8)(Lba) >> 8);
- Out8(IO + ATA_REG_LBA2, (UInt8)(Lba) >> 16);
+ Out8(IO + ATA_REG_LBA0, (Lba));
+ Out8(IO + ATA_REG_LBA1, (Lba) >> 8);
+ Out8(IO + ATA_REG_LBA2, (Lba) >> 16);
Out8(IO + ATA_REG_COMMAND, ATA_CMD_WRITE_PIO);
diff --git a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx
index b9e59db4..ffe7af73 100644
--- a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx
@@ -162,6 +162,8 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle,
writer.Write(L"NewBoot.exe: Installing NewKernel and it's components...\r\n");
+ ST->ConOut->ClearScreen(ST->ConOut);
+
EFI::ExitBootServices(MapKey, ImageHandle);
Main(handoverHdrPtr);
@@ -172,6 +174,8 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle,
writer.Write(L"NewBoot.exe: Running NewKernel...\r\n");
+ ST->ConOut->ClearScreen(ST->ConOut);
+
EFI::ExitBootServices(MapKey, ImageHandle);
}
diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile
index 0bded801..e4ed6cbe 100644
--- a/Private/NewBoot/Source/makefile
+++ b/Private/NewBoot/Source/makefile
@@ -17,7 +17,7 @@ EMU=qemu-system-x86_64w.exe
endif
IMG=epm.img
-EMU_FLAGS=-net none -smp 2 -m 4G -M q35 -bios OVMF.fd -device piix3-ide,id=ide -drive id=disk,file=$(IMG),format=raw,if=none -device ide-hd,drive=disk,bus=ide.0 -drive file=fat:rw:CDROM,index=2,format=raw -d int
+EMU_FLAGS=-net none -smp 2 -m 4G -M q35 -bios OVMF.fd -device piix3-ide,id=ide -drive id=disk,file=$(IMG),format=raw,if=none -device ide-hd,drive=disk,bus=ide.0 -drive file=fat:rw:CDROM,index=2,format=raw -serial stdio
LD_FLAGS=-e efi_main --subsystem=10
OBJ=$(wildcard *.o) $(wildcard ../../Objects/*.obj) $(wildcard HEL/AMD64/*.obj)
diff --git a/Private/Source/ProcessScheduler.cxx b/Private/Source/ProcessScheduler.cxx
index 2ab30e94..a2c47225 100644
--- a/Private/Source/ProcessScheduler.cxx
+++ b/Private/Source/ProcessScheduler.cxx
@@ -268,7 +268,7 @@ bool ProcessHelper::StartScheduling() {
SizeT ret = processRef.Run();
kcout << StringBuilder::FromInt(
- "ProcessHelper::StartScheduling() Iterated over: % jobs.\r\n", ret);
+ "ProcessHelper::StartScheduling() Iterated over {%} jobs inside team.\r\n", ret);
return true;
}
diff --git a/Private/Source/ProcessTeam.cxx b/Private/Source/ProcessTeam.cxx
index 53b55a0f..45cfb3bc 100644
--- a/Private/Source/ProcessTeam.cxx
+++ b/Private/Source/ProcessTeam.cxx
@@ -12,7 +12,12 @@
#include <KernelKit/ProcessScheduler.hpp>
namespace HCore {
+/// @brief Process list array getter.
+/// @return
MutableArray<Ref<ProcessHeader>>& ProcessTeam::AsArray() { return mProcessList; }
+
+/// @brief Current process getter.
+/// @return
Ref<ProcessHeader>& ProcessTeam::AsRef() { return mCurrentProcess; }
} // namespace HCore