summaryrefslogtreecommitdiffhomepage
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/boot/modules/BootNet/BootNet.cc2
-rw-r--r--dev/boot/src/BootFileReader.cc6
-rw-r--r--dev/boot/src/HEL/AMD64/BootEFI.cc8
-rw-r--r--dev/boot/src/HEL/ARM64/BootEFI.cc6
-rw-r--r--dev/kernel/DmaKit/DmaPool.h29
-rw-r--r--dev/kernel/FirmwareKit/EFI/EFI.h24
-rw-r--r--dev/kernel/FirmwareKit/GPT.h6
-rw-r--r--dev/kernel/FirmwareKit/VEPM.h4
-rw-r--r--dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc16
-rw-r--r--dev/kernel/HALKit/AMD64/HalDebugProtocol.cc (renamed from dev/kernel/HALKit/AMD64/HalDebugPort.cc)6
-rw-r--r--dev/kernel/HALKit/AMD64/HalKernelMain.cc20
-rw-r--r--dev/kernel/KernelKit/DeviceMgr.h17
-rw-r--r--dev/kernel/KernelKit/FileMgr.h7
-rw-r--r--dev/kernel/KernelKit/IDylibObject.h15
-rw-r--r--dev/kernel/KernelKit/IPEFDylibObject.h8
-rw-r--r--dev/kernel/KernelKit/KPC.h5
-rw-r--r--dev/kernel/NetworkKit/NetworkDevice.h8
-rw-r--r--dev/kernel/SwapKit/DiskSwap.h2
-rw-r--r--dev/kernel/src/DeviceMgr.cc2
-rw-r--r--dev/kernel/src/IPEFDylibObject.cc2
-rw-r--r--dev/kernel/src/Swap/DiskSwap.cc2
21 files changed, 100 insertions, 95 deletions
diff --git a/dev/boot/modules/BootNet/BootNet.cc b/dev/boot/modules/BootNet/BootNet.cc
index 60d1bd77..2fbd7edc 100644
--- a/dev/boot/modules/BootNet/BootNet.cc
+++ b/dev/boot/modules/BootNet/BootNet.cc
@@ -12,7 +12,7 @@
#include <FirmwareKit/EFI/API.h>
#include <modules/BootNet/BootNet.h>
-STATIC EfiGUID kEfiSimpleProtoGUID = EFI_SIMPLE_NETWORK_PROTOCOL_GUID;
+STATIC EFI_GUID kEfiSimpleProtoGUID = EFI_SIMPLE_NETWORK_PROTOCOL_GUID;
STATIC EFI_SIMPLE_NETWORK_PROTOCOL* kEfiProtocol = nullptr;
STATIC Void bootnet_read_ip_packet(BOOTNET_INTERNET_HEADER inet,
diff --git a/dev/boot/src/BootFileReader.cc b/dev/boot/src/BootFileReader.cc
index 32060bd7..2f409848 100644
--- a/dev/boot/src/BootFileReader.cc
+++ b/dev/boot/src/BootFileReader.cc
@@ -43,12 +43,12 @@ Boot::BootFileReader::BootFileReader(const CharacterTypeUTF16* path, EfiHandlePt
/// Load protocols with their GUIDs.
- EfiGUID guidEfp = EfiGUID(EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID);
+ EFI_GUID guidEfp = EFI_GUID(EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID);
EfiSimpleFilesystemProtocol* efp = nullptr;
EfiLoadImageProtocol* img = nullptr;
- EfiGUID guidImg = EfiGUID(EFI_LOADED_IMAGE_PROTOCOL_GUID);
+ EFI_GUID guidImg = EFI_GUID(EFI_LOADED_IMAGE_PROTOCOL_GUID);
if (BS->HandleProtocol(ImageHandle, &guidImg, (void**) &img) != kEfiOk) {
mWriter.Write(L"BootZ: Handle-Protocol: No-Such-Protocol").Write(L"\r");
@@ -116,7 +116,7 @@ Void Boot::BootFileReader::ReadAll(SizeT readUntil, SizeT chunkToRead, UIntPtr o
EfiFileInfo newPtrInfo{};
- EfiGUID kFileInfoGUID = EFI_FILE_INFO_GUID;
+ EFI_GUID kFileInfoGUID = EFI_FILE_INFO_GUID;
if (mFile->GetInfo(mFile, &kFileInfoGUID, &szInfo, &newPtrInfo) == kEfiOk) {
readUntil = newPtrInfo.FileSize;
diff --git a/dev/boot/src/HEL/AMD64/BootEFI.cc b/dev/boot/src/HEL/AMD64/BootEFI.cc
index e1dd5d9e..3685add5 100644
--- a/dev/boot/src/HEL/AMD64/BootEFI.cc
+++ b/dev/boot/src/HEL/AMD64/BootEFI.cc
@@ -21,7 +21,7 @@
STATIC EfiGraphicsOutputProtocol* kGop = nullptr;
STATIC UInt16 kGopStride = 0U;
-STATIC EfiGUID kGopGuid;
+STATIC EFI_GUID kGopGuid;
/** Related to jumping to the reset vector. */
@@ -33,7 +33,7 @@ EXTERN_C Kernel::VoidPtr boot_read_cr3(); // @brief Page directory inside cr3 r
@brief Finds and stores the GOP object.
*/
STATIC Bool boot_init_fb() noexcept {
- kGopGuid = EfiGUID(EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID);
+ kGopGuid = EFI_GUID(EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID);
kGop = nullptr;
if (BS->LocateProtocol(&kGopGuid, nullptr, (VoidPtr*) &kGop) != kEfiOk) return No;
@@ -43,7 +43,7 @@ STATIC Bool boot_init_fb() noexcept {
return Yes;
}
-EfiGUID kEfiGlobalNamespaceVarGUID = {
+EFI_GUID kEfiGlobalNamespaceVarGUID = {
0x8BE4DF61, 0x93CA, 0x11D2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C}};
/// @brief BootloaderMain EFI entrypoint.
@@ -102,7 +102,7 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa
// Grab MP services, extended to runtime. //
// ------------------------------------------- //
- EfiGUID guid_mp = EfiGUID(EFI_MP_SERVICES_PROTOCOL_GUID);
+ EFI_GUID guid_mp = EFI_GUID(EFI_MP_SERVICES_PROTOCOL_GUID);
EfiMpServicesProtocol* mp = nullptr;
BS->LocateProtocol(&guid_mp, nullptr, reinterpret_cast<VoidPtr*>(&mp));
diff --git a/dev/boot/src/HEL/ARM64/BootEFI.cc b/dev/boot/src/HEL/ARM64/BootEFI.cc
index 413edd5b..1633cb39 100644
--- a/dev/boot/src/HEL/ARM64/BootEFI.cc
+++ b/dev/boot/src/HEL/ARM64/BootEFI.cc
@@ -29,7 +29,7 @@
STATIC EfiGraphicsOutputProtocol* kGop = nullptr;
STATIC UInt16 kGopStride = 0U;
-STATIC EfiGUID kGopGuid;
+STATIC EFI_GUID kGopGuid;
EXTERN_C Void rt_reset_hardware();
@@ -39,7 +39,7 @@ EXTERN EfiBootServices* BS;
@brief Finds and stores the GOP object.
*/
STATIC Bool boot_init_fb() noexcept {
- kGopGuid = EfiGUID(EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID);
+ kGopGuid = EFI_GUID(EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID);
kGop = nullptr;
if (BS->LocateProtocol(&kGopGuid, nullptr, (VoidPtr*) &kGop) != kEfiOk) return No;
@@ -107,7 +107,7 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa
// Grab MP services, extended to runtime. //
// ------------------------------------------- //
- EfiGUID guid_mp = EfiGUID(EFI_MP_SERVICES_PROTOCOL_GUID);
+ EFI_GUID guid_mp = EFI_GUID(EFI_MP_SERVICES_PROTOCOL_GUID);
EfiMpServicesProtocol* mp = nullptr;
BS->LocateProtocol(&guid_mp, nullptr, reinterpret_cast<VoidPtr*>(&mp));
diff --git a/dev/kernel/DmaKit/DmaPool.h b/dev/kernel/DmaKit/DmaPool.h
index 5acff623..d15346b8 100644
--- a/dev/kernel/DmaKit/DmaPool.h
+++ b/dev/kernel/DmaKit/DmaPool.h
@@ -1,24 +1,11 @@
-/*
- * Copyright (c) 2025 Amlal El Mahrouss. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
+/* -------------------------------------------
+
+ Copyright (C) 2025, Amlal El Mahrouss , all rights reserved.
+
+ File: FileMgr.h
+ Purpose: Kernel file manager.
+
+------------------------------------------- */
#pragma once
diff --git a/dev/kernel/FirmwareKit/EFI/EFI.h b/dev/kernel/FirmwareKit/EFI/EFI.h
index 3512191a..ed22f1e9 100644
--- a/dev/kernel/FirmwareKit/EFI/EFI.h
+++ b/dev/kernel/FirmwareKit/EFI/EFI.h
@@ -42,7 +42,7 @@ struct EfiDevicePathProtocol;
struct EfiBootServices;
struct EfiMemoryDescriptor;
struct EfiSystemTable;
-struct EfiGUID;
+struct EFI_GUID;
struct EfiFileDevicePathProtocol;
struct EfiHandle;
struct EfiGraphicsOutputProtocol;
@@ -85,9 +85,9 @@ typedef UInt64(EFI_API* EfiCopyMem)(VoidPtr DstBuf, VoidPtr SrcBuf, SizeT Length
typedef UInt64(EFI_API* EfiSetMem)(VoidPtr DstBuf, Char Byte, SizeT Length);
-typedef UInt64(EFI_API* EfiHandleProtocol)(EfiHandlePtr Handle, EfiGUID* Guid, VoidPtr* Device);
+typedef UInt64(EFI_API* EfiHandleProtocol)(EfiHandlePtr Handle, EFI_GUID* Guid, VoidPtr* Device);
-typedef UInt64(EFI_API* EfiLocateDevicePath)(EfiGUID* Protocol, EfiDevicePathProtocol** DevicePath,
+typedef UInt64(EFI_API* EfiLocateDevicePath)(EFI_GUID* Protocol, EfiDevicePathProtocol** DevicePath,
EfiHandlePtr Device);
typedef UInt64(EFI_API* EfiStartImage)(EfiHandlePtr Handle, VoidPtr ArgsSize, VoidPtr ArgsPtr);
@@ -495,12 +495,12 @@ typedef UInt64(EFI_API* EfiGetMemoryMap)(UInt32* MapSize, EfiMemoryDescriptor* D
/**
* @brief GUID type, something you can also find in CFKit.
*/
-typedef struct EfiGUID EFI_FINAL {
+typedef struct EFI_GUID EFI_FINAL {
UInt32 Data1;
UInt16 Data2;
UInt16 Data3;
UInt8 Data4[8];
-} EfiGUID;
+} EFI_GUID;
/***
* Protocol stuff...
@@ -519,10 +519,10 @@ typedef struct EfiGUID EFI_FINAL {
#define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010
#define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020
-typedef UInt64(EFI_API* EfiLocateProtocol)(EfiGUID* Protocol, VoidPtr Registration,
+typedef UInt64(EFI_API* EfiLocateProtocol)(EFI_GUID* Protocol, VoidPtr Registration,
VoidPtr* Interface);
-typedef UInt64(EFI_API* EfiOpenProtocol)(EfiHandlePtr Handle, EfiGUID* Guid, VoidPtr* Interface,
+typedef UInt64(EFI_API* EfiOpenProtocol)(EfiHandlePtr Handle, EFI_GUID* Guid, VoidPtr* Interface,
EfiHandlePtr AgentHandle, EfiHandlePtr ControllerHandle,
UInt32 Attributes);
@@ -633,10 +633,10 @@ struct EfiSimpleFilesystemProtocol {
typedef struct EfiRuntimeServices {
EfiTableHeader SystemTable;
VoidPtr GetTime, SetTime, GetWakeupTime, SetWakeupTime, SetVirtualAddressMap, ConvertPointer;
- UInt64(EFI_API* GetVariable)(const WideChar* Name, EfiGUID VendorGUID, UInt32* Attributes,
+ UInt64(EFI_API* GetVariable)(const WideChar* Name, EFI_GUID VendorGUID, UInt32* Attributes,
UInt32* DataSize, VoidPtr Data);
VoidPtr GetNextVariable;
- UInt64(EFI_API* SetVariable)(const WideChar* Name, EfiGUID VendorGUID, UInt32* Attributes,
+ UInt64(EFI_API* SetVariable)(const WideChar* Name, EFI_GUID VendorGUID, UInt32* Attributes,
UInt32* DataSize, VoidPtr Data);
VoidPtr GetNextHighMonotonicCount;
VoidPtr ResetSystem;
@@ -663,7 +663,7 @@ typedef struct EfiSystemTable {
UInt64 NumberOfTableEntries;
/// The configuration table (contains the RSD PTR entry.)
struct {
- EfiGUID VendorGUID;
+ EFI_GUID VendorGUID;
VoidPtr VendorTable;
} * ConfigurationTable;
} EfiSystemTable;
@@ -792,9 +792,9 @@ typedef struct EfiFileProtocol {
EfiStatusType(EFI_API* SetPosition)(EfiFileProtocol* Self, UInt64* Position);
- EfiStatusType(EFI_API* GetInfo)(struct EfiFileProtocol*, struct EfiGUID*, UInt32*, void*);
+ EfiStatusType(EFI_API* GetInfo)(struct EfiFileProtocol*, struct EFI_GUID*, UInt32*, void*);
- EfiStatusType(EFI_API* SetInfo)(struct EfiFileProtocol*, struct EfiGUID*, UInt32*, void*);
+ EfiStatusType(EFI_API* SetInfo)(struct EfiFileProtocol*, struct EFI_GUID*, UInt32*, void*);
EfiStatusType(EFI_API* Flush)(EfiFileProtocol*);
diff --git a/dev/kernel/FirmwareKit/GPT.h b/dev/kernel/FirmwareKit/GPT.h
index 370f2517..df0ed286 100644
--- a/dev/kernel/FirmwareKit/GPT.h
+++ b/dev/kernel/FirmwareKit/GPT.h
@@ -29,7 +29,7 @@ struct PACKED GPT_PARTITION_TABLE final {
UInt64 LBAAltHeader;
UInt64 FirstGPTEntry;
UInt64 LastGPTEntry;
- EfiGUID Guid;
+ EFI_GUID Guid;
UInt64 StartingLBA;
UInt32 NumPartitionEntries;
UInt32 SizeOfEntries;
@@ -38,8 +38,8 @@ struct PACKED GPT_PARTITION_TABLE final {
};
struct PACKED GPT_PARTITION_ENTRY {
- EfiGUID PartitionTypeGUID;
- EfiGUID UniquePartitionGUID;
+ EFI_GUID PartitionTypeGUID;
+ EFI_GUID UniquePartitionGUID;
UInt64 StartLBA;
UInt64 EndLBA;
UInt64 Attributes;
diff --git a/dev/kernel/FirmwareKit/VEPM.h b/dev/kernel/FirmwareKit/VEPM.h
index ca6c83bf..30f6c04d 100644
--- a/dev/kernel/FirmwareKit/VEPM.h
+++ b/dev/kernel/FirmwareKit/VEPM.h
@@ -12,7 +12,7 @@
/// @brief The Virtual Explicit Partition Map scheme extension.
-#ifdef __NE_VEPM__
+#if defined(__NE_VEPM__)
#ifdef kEPMMagic
#undef kEPMMagic
#endif // kEPMMagic
@@ -26,7 +26,7 @@ inline EPM_GUID kVEPMGuidEPM = {
/// @brief VEPM GUID.
/// @note This is the GUID used to identify a VEPM partition (EFI version)
-inline EfiGUID kVEPMGuidEFI = {
+inline EFI_GUID kVEPMGuidEFI = {
0x9a1b3f2e, 0x4c3f, 0x4d52, {0xa7, 0x83, 0x9c, 0x21, 0x7b, 0x5e, 0x4d, 0xac}};
#define kVEPMGuidStr "9a1b3f2e-4c3f-4d52-a783-9c217b5e4dac"
diff --git a/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc b/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc
index cb1ec59b..3e10d577 100644
--- a/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc
+++ b/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc
@@ -117,7 +117,6 @@ EXTERN_C BOOL mp_register_task(HAL::StackFramePtr stack_frame, ThreadID thrdid)
if (!stack_frame) return NO;
kHWThread[thrdid].mFramePtr = stack_frame;
- kHWThread[thrdid].mThreadID = thrdid;
HardwareThreadScheduler::The()[thrdid].Leak()->Busy(NO);
@@ -165,17 +164,18 @@ Void mp_init_cores(VoidPtr vendor_ptr) noexcept {
kSMPInterrupt = 0;
kSMPCount = 0;
- UInt32 lo = 0, hi = 0;
+ UInt32 lo = 0U, hi = 0U;
+
+ hal_get_msr(APIC_BASE_MSR, &lo, &hi);
- hal_get_msr(0x1B, &lo, &hi);
UInt64 apic_base = ((UInt64) hi << 32) | lo;
- apic_base |= 0x800; // enable bit
+ apic_base |= APIC_BASE_MSR_ENABLE; // Enable APIC.
lo = apic_base & 0xFFFFFFFF;
hi = apic_base >> 32;
- hal_set_msr(0x1B, lo, hi);
+ hal_set_msr(APIC_BASE_MSR, lo, hi);
kApicBaseAddress = apic_base & 0xFFFFF000;
@@ -184,7 +184,7 @@ Void mp_init_cores(VoidPtr vendor_ptr) noexcept {
controller.Write(LAPIC_REG_ENABLE, 0);
controller.Write(LAPIC_REG_SPURIOUS, 0x1FF); // Enable bit, spurious interrupt vector register.
controller.Write(LAPIC_REG_TIMER_DIV, 0b0011);
- controller.Write(LAPIC_REG_TIMER_LVT, 32 | (1 << 17));
+ controller.Write(LAPIC_REG_TIMER_LVT, 0x20 | (1 << 17));
controller.Write(LAPIC_REG_TIMER_INITCNT, 1000000);
volatile UInt8* entry_ptr = reinterpret_cast<volatile UInt8*>(kMADTBlock->List);
@@ -202,6 +202,8 @@ Void mp_init_cores(VoidPtr vendor_ptr) noexcept {
if (entry_struct->Flags & 0x1) {
kAPICLocales[kSMPCount] = entry_struct->ProcessorID;
+ kHWThread[kSMPCount].mThreadID = kAPICLocales[kSMPCount];
+
++kSMPCount;
kout << "Kind: LAPIC: ON\r";
@@ -212,7 +214,7 @@ Void mp_init_cores(VoidPtr vendor_ptr) noexcept {
kout << "Kind: LAPIC: OFF\r";
}
} else {
- kout << "Kind: UNKNOWN: ?\r";
+ kout << "Kind: UNKNOWN\r";
}
entry_ptr += length;
diff --git a/dev/kernel/HALKit/AMD64/HalDebugPort.cc b/dev/kernel/HALKit/AMD64/HalDebugProtocol.cc
index 4e0e2b7f..8a1249ea 100644
--- a/dev/kernel/HALKit/AMD64/HalDebugPort.cc
+++ b/dev/kernel/HALKit/AMD64/HalDebugProtocol.cc
@@ -13,8 +13,4 @@
// after that we have start of additional data.
-namespace Kernel {
-Void rt_debug_listen(KernelDebugHeader* the_hdr) noexcept {
- NE_UNUSED(the_hdr);
-}
-} // namespace Kernel
+namespace Kernel {} // namespace Kernel
diff --git a/dev/kernel/HALKit/AMD64/HalKernelMain.cc b/dev/kernel/HALKit/AMD64/HalKernelMain.cc
index 97043227..e7337e62 100644
--- a/dev/kernel/HALKit/AMD64/HalKernelMain.cc
+++ b/dev/kernel/HALKit/AMD64/HalKernelMain.cc
@@ -23,11 +23,13 @@ EXTERN_C Kernel::VoidPtr kInterruptVectorTable[];
/// @brief Kernel init function.
/// @param handover_hdr Handover boot header.
EXTERN_C Int32 hal_init_platform(Kernel::HEL::BootInfoHeader* handover_hdr) {
+ using namespace Kernel;
+
if (handover_hdr->f_Magic != kHandoverMagic && handover_hdr->f_Version != kHandoverVersion) {
return kEfiFail;
}
- Kernel::HAL::rt_sti();
+ HAL::rt_sti();
kHandoverHeader = handover_hdr;
@@ -46,9 +48,9 @@ EXTERN_C Int32 hal_init_platform(Kernel::HEL::BootInfoHeader* handover_hdr) {
/* INITIALIZE BIT MAP. */
/************************************** */
- kKernelBitMpSize = kHandoverHeader->f_BitMapSize;
- kKernelBitMpStart = reinterpret_cast<Kernel::VoidPtr>(
- reinterpret_cast<Kernel::UIntPtr>(kHandoverHeader->f_BitMapStart));
+ kKernelBitMpSize = kHandoverHeader->f_BitMapSize;
+ kKernelBitMpStart =
+ reinterpret_cast<VoidPtr>(reinterpret_cast<UIntPtr>(kHandoverHeader->f_BitMapStart));
/************************************** */
/* INITIALIZE GDT AND SEGMENTS. */
@@ -62,7 +64,7 @@ EXTERN_C Int32 hal_init_platform(Kernel::HEL::BootInfoHeader* handover_hdr) {
kKernelTSS.fIopb = sizeof(HAL::Detail::NE_TSS);
/* The GDT, mostly descriptors for user and kernel segments. */
- STATIC Kernel::HAL::Detail::NE_GDT_ENTRY ALIGN(0x08) kGDTArray[kGDTEntriesCount] = {
+ STATIC HAL::Detail::NE_GDT_ENTRY ALIGN(0x08) kGDTArray[kGDTEntriesCount] = {
{.fLimitLow = 0,
.fBaseLow = 0,
.fBaseMid = 0,
@@ -112,13 +114,13 @@ EXTERN_C Int32 hal_init_platform(Kernel::HEL::BootInfoHeader* handover_hdr) {
kGDTArray[4].fBaseHigh = 0;
// Load memory descriptors.
- Kernel::HAL::Register64 gdt_reg;
+ HAL::Register64 gdt_reg;
- gdt_reg.Base = reinterpret_cast<Kernel::UIntPtr>(kGDTArray);
- gdt_reg.Limit = (sizeof(Kernel::HAL::Detail::NE_GDT_ENTRY) * kGDTEntriesCount) - 1;
+ gdt_reg.Base = reinterpret_cast<UIntPtr>(kGDTArray);
+ gdt_reg.Limit = (sizeof(HAL::Detail::NE_GDT_ENTRY) * kGDTEntriesCount) - 1;
//! GDT will load hal_read_init after it successfully loads the segments.
- Kernel::HAL::GDTLoader gdt_loader;
+ HAL::GDTLoader gdt_loader;
gdt_loader.Load(gdt_reg);
return kEfiFail;
diff --git a/dev/kernel/KernelKit/DeviceMgr.h b/dev/kernel/KernelKit/DeviceMgr.h
index 8d749ec9..7c7b9da3 100644
--- a/dev/kernel/KernelKit/DeviceMgr.h
+++ b/dev/kernel/KernelKit/DeviceMgr.h
@@ -8,8 +8,8 @@
Revision History:
- 31/01/24: Add kDeviceCnt (amlel)
- 15/11/24: Add NE_DEVICE macro, to inherit from device object.
+ 31/01/24: Add kDeviceCnt (amlel)
+ 15/11/24: Add NE_DEVICE macro, to inherit from device object.
------------------------------------------- */
@@ -26,12 +26,15 @@
#define NE_DEVICE : public ::Kernel::IDeviceObject
-// Last Rev: Wed, Apr 3, 2024 9:09:41 AM
+// Last Rev: Wed, May 27, 2025 6:22 PM
namespace Kernel {
template <typename T>
class IDeviceObject;
+template <typename T>
+class IOBuf;
+
/***********************************************************************************/
/// @brief Device contract interface, represents an HW device.
/***********************************************************************************/
@@ -103,7 +106,8 @@ class IOBuf final {
///! @brief Device enum types.
enum {
- kDeviceTypeIDE,
+ kDeviceTypeInvalid = 0,
+ kDeviceTypeIDE = 100,
kDeviceTypeEthernet,
kDeviceTypeWiFi,
kDeviceTypeFW,
@@ -114,7 +118,10 @@ enum {
kDeviceTypeMBCI,
kDeviceTypeATA,
kDeviceTypeUSB,
- kDeviceTypeMediaCtrl, // MM controller
+ kDeviceTypeAPM, // Adv. Pwr. Mgmt.
+ kDeviceTypePCI,
+ kDeviceTypeVGA,
+ kDeviceTypeGPU,
kDeviceTypeCount,
};
} // namespace Kernel
diff --git a/dev/kernel/KernelKit/FileMgr.h b/dev/kernel/KernelKit/FileMgr.h
index dcce787f..13eeabdf 100644
--- a/dev/kernel/KernelKit/FileMgr.h
+++ b/dev/kernel/KernelKit/FileMgr.h
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright (C) 2024-2025, Amlal El Mahrouss Labs, all rights reserved.
+ Copyright (C) 2024-2025, Amlal El Mahrouss , all rights reserved.
File: FileMgr.h
Purpose: Kernel file manager.
@@ -52,6 +52,7 @@
@note Refer to first enum.
*/
#define kFileOpsCount (4U)
+
#define kFileMimeGeneric "ne-application-kind/all"
/** @brief invalid position. (n-pos) */
@@ -344,7 +345,7 @@ using FileStreamUTF16 = FileStream<WideChar>;
typedef UInt64 CursorType;
-inline static const auto kRestrictStrLen = 8U;
+inline STATIC const auto kRestrictStrLen = 8U;
/// @brief restrict information about the file descriptor.
struct FILEMGR_RESTRICT final {
@@ -386,7 +387,7 @@ inline FileStream<Encoding, Class>::FileStream(const Encoding* path, const Encod
}
}
- kout << "FileMgr: New file at: " << path << ".\r";
+ kout << "FileMgr: Open file at: " << path << ".\r";
}
/// @brief destructor of the file stream.
diff --git a/dev/kernel/KernelKit/IDylibObject.h b/dev/kernel/KernelKit/IDylibObject.h
index da6c3a7a..b673766c 100644
--- a/dev/kernel/KernelKit/IDylibObject.h
+++ b/dev/kernel/KernelKit/IDylibObject.h
@@ -15,26 +15,29 @@
#define NE_DYLIB_OBJECT : public IDylibObject
namespace Kernel {
+class IDylibObject;
+
/// @brief Dylib class object. A handle to a shared library.
class IDylibObject {
public:
explicit IDylibObject() = default;
virtual ~IDylibObject() = default;
- struct DLL_TRAITS final {
+ struct DylibTraits final {
VoidPtr ImageObject{nullptr};
VoidPtr ImageEntrypointOffset{nullptr};
- Bool IsValid() { return ImageObject && ImageEntrypointOffset; }
+ VoidPtr Image() const { return ImageObject; }
+ Bool IsValid() const { return ImageObject && ImageEntrypointOffset; }
};
NE_COPY_DEFAULT(IDylibObject)
- virtual DLL_TRAITS** GetAddressOf() = 0;
- virtual DLL_TRAITS* Get() = 0;
+ virtual DylibTraits** GetAddressOf() = 0;
+ virtual DylibTraits* Get() = 0;
- virtual Void Mount(DLL_TRAITS* to_mount) = 0;
- virtual Void Unmount() = 0;
+ virtual Void Mount(DylibTraits* to_mount) = 0;
+ virtual Void Unmount() = 0;
};
/// @brief Pure implementation, missing method/function handler.
diff --git a/dev/kernel/KernelKit/IPEFDylibObject.h b/dev/kernel/KernelKit/IPEFDylibObject.h
index f4461a69..66b4895d 100644
--- a/dev/kernel/KernelKit/IPEFDylibObject.h
+++ b/dev/kernel/KernelKit/IPEFDylibObject.h
@@ -30,15 +30,15 @@ class IPEFDylibObject final NE_DYLIB_OBJECT {
NE_COPY_DEFAULT(IPEFDylibObject)
private:
- DLL_TRAITS* fMounted{nullptr};
+ DylibTraits* fMounted{nullptr};
public:
- DLL_TRAITS** GetAddressOf() { return &fMounted; }
+ DylibTraits** GetAddressOf() { return &fMounted; }
- DLL_TRAITS* Get() { return fMounted; }
+ DylibTraits* Get() { return fMounted; }
public:
- void Mount(DLL_TRAITS* to_mount) {
+ void Mount(DylibTraits* to_mount) {
if (!to_mount || !to_mount->ImageObject) return;
fMounted = to_mount;
diff --git a/dev/kernel/KernelKit/KPC.h b/dev/kernel/KernelKit/KPC.h
index 811d7f5d..a3b13de6 100644
--- a/dev/kernel/KernelKit/KPC.h
+++ b/dev/kernel/KernelKit/KPC.h
@@ -63,9 +63,8 @@ inline constexpr KPCError kErrorCDTrayBroken = 62;
inline constexpr KPCError kErrorUnrecoverableDisk = 63;
inline constexpr KPCError kErrorFileLocked = 64;
inline constexpr KPCError kErrorDiskIsTooTiny = 65;
-/// Kernel errors.
-inline constexpr KPCError kErrorDmaExhausted = 101;
-inline constexpr KPCError kErrorOutOfBitMapMemory = 102;
+inline constexpr KPCError kErrorDmaExhausted = 66;
+inline constexpr KPCError kErrorOutOfBitMapMemory = 67;
/// Generic errors.
inline constexpr KPCError kErrorUnimplemented = -1;
diff --git a/dev/kernel/NetworkKit/NetworkDevice.h b/dev/kernel/NetworkKit/NetworkDevice.h
index e67916ee..c37d8504 100644
--- a/dev/kernel/NetworkKit/NetworkDevice.h
+++ b/dev/kernel/NetworkKit/NetworkDevice.h
@@ -19,7 +19,7 @@ class NetworkDevice;
/**
* \brief Network device interface, establishes a connection to the NIC.
*/
-class NetworkDevice final : public IDeviceObject<NetworkDeviceCommand> {
+class NetworkDevice final NE_DEVICE<NetworkDeviceCommand> {
public:
NetworkDevice(void (*out)(IDeviceObject<NetworkDeviceCommand>*, NetworkDeviceCommand),
void (*in)(IDeviceObject<NetworkDeviceCommand>*, NetworkDeviceCommand),
@@ -68,6 +68,12 @@ using GSMNetworkDevice = NetworkDevice;
/// @brief Bluetooth device.
using BTNetworkDevice = NetworkDevice;
+/// @brief Printer device.
+using PrinterNetworkDevice = NetworkDevice;
+
+/// @brief Debug device.
+using DBGNetworkDevice = NetworkDevice;
+
/// @brief LTE device.
using LTENetworkDevice = NetworkDevice;
} // namespace Kernel
diff --git a/dev/kernel/SwapKit/DiskSwap.h b/dev/kernel/SwapKit/DiskSwap.h
index 40b3adb0..1a0536c9 100644
--- a/dev/kernel/SwapKit/DiskSwap.h
+++ b/dev/kernel/SwapKit/DiskSwap.h
@@ -1,7 +1,7 @@
/* -------------------------------------------
- Copyright (C) 2024-2025 Amlal El Mahrouss Labs, all rights reserved.
+ Copyright (C) 2024-2025 Amlal El Mahrouss , all rights reserved.
------------------------------------------- */
diff --git a/dev/kernel/src/DeviceMgr.cc b/dev/kernel/src/DeviceMgr.cc
index c137552e..b12470a9 100644
--- a/dev/kernel/src/DeviceMgr.cc
+++ b/dev/kernel/src/DeviceMgr.cc
@@ -5,3 +5,5 @@
------------------------------------------- */
#include <KernelKit/DeviceMgr.h>
+
+namespace Kernel {} // namespace Kernel
diff --git a/dev/kernel/src/IPEFDylibObject.cc b/dev/kernel/src/IPEFDylibObject.cc
index 6af0718e..d1d4eeca 100644
--- a/dev/kernel/src/IPEFDylibObject.cc
+++ b/dev/kernel/src/IPEFDylibObject.cc
@@ -49,7 +49,7 @@ EXTERN_C IDylibRef rtl_init_dylib_pef(USER_PROCESS& process) {
return nullptr;
}
- dll_obj->Mount(new IPEFDylibObject::DLL_TRAITS());
+ dll_obj->Mount(new IPEFDylibObject::DylibTraits());
if (!dll_obj->Get()) {
tls_delete_class(dll_obj);
diff --git a/dev/kernel/src/Swap/DiskSwap.cc b/dev/kernel/src/Swap/DiskSwap.cc
index 118be0f6..8578450c 100644
--- a/dev/kernel/src/Swap/DiskSwap.cc
+++ b/dev/kernel/src/Swap/DiskSwap.cc
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright (C) 2024-2025 Amlal El Mahrouss Labs, all rights reserved.
+ Copyright (C) 2024-2025 Amlal El Mahrouss , all rights reserved.
------------------------------------------- */