summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-04-01 08:39:18 +0200
committerGitHub <noreply@github.com>2025-04-01 08:39:18 +0200
commitf88f6074479c627529559f690bf836960d5a6378 (patch)
treea1acef0bd6286f03197c0e1839e8d41ac5e5538f
parent6849e75f2e95e88b43e2f8804abf1b862e3981cb (diff)
parent2a7a9825fd275d6d999b94614fe87c1d705c7f8f (diff)
Merge pull request #4 from amlel-el-mahrouss/dev
pr/general: mostly minor patches.
-rw-r--r--dev/boot/BootKit/BootKit.h2
-rw-r--r--dev/boot/BootKit/Qr.h2
-rw-r--r--dev/boot/amd64-ci.make8
-rw-r--r--dev/boot/amd64-desktop.make8
-rw-r--r--dev/boot/arm64-desktop.make4
-rw-r--r--dev/boot/gdbinit2
-rw-r--r--dev/boot/modules/BootNet/BootNet.cc4
-rw-r--r--dev/boot/modules/SysChk/SysChk.cc6
-rw-r--r--dev/boot/src/BootFileReader.cc2
-rw-r--r--dev/boot/src/BootThread.cc2
-rw-r--r--dev/boot/src/HEL/AMD64/BootEFI.cc10
-rw-r--r--dev/boot/src/HEL/ARM64/BootEFI.cc10
-rw-r--r--dev/kernel/FirmwareKit/EFI/API.h2
-rw-r--r--dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc2
-rw-r--r--dev/kernel/HALKit/AMD64/HalDebugOutput.cc4
-rw-r--r--dev/kernel/HALKit/AMD64/HalKernelMain.cc2
-rw-r--r--dev/kernel/HALKit/AMD64/HalKernelPanic.cc4
-rw-r--r--dev/kernel/HALKit/AMD64/HalUtilsAPI.asm (renamed from dev/kernel/HALKit/AMD64/HalUtils.asm)0
-rw-r--r--dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc146
-rw-r--r--dev/kernel/HALKit/ARM64/HalKernelMain.cc2
-rw-r--r--dev/kernel/HALKit/ARM64/HalKernelPanic.cc4
-rw-r--r--dev/kernel/KernelKit/Defines.h4
-rw-r--r--dev/kernel/NewKit/Defines.h4
-rw-r--r--dev/kernel/amd64-ci.make2
-rw-r--r--dev/kernel/amd64-desktop.make2
-rw-r--r--dev/kernel/src/Network/NetworkDevice.cc13
-rw-r--r--dev/modules/CoreGfx/CoreAccess.h (renamed from dev/modules/CoreGfx/AccessibilityMgr.h)4
-rw-r--r--dev/modules/CoreGfx/CoreGfx.h (renamed from dev/modules/CoreGfx/FBMgr.h)2
-rw-r--r--dev/modules/CoreGfx/MathGfx.h (renamed from dev/modules/CoreGfx/MathMgr.h)0
-rw-r--r--dev/modules/CoreGfx/TextGfx.h (renamed from dev/modules/CoreGfx/TextMgr.h)2
-rw-r--r--public/frameworks/DiskImage.fwrk/headers/DiskImage.h50
-rw-r--r--public/frameworks/DiskImage.fwrk/src/DiskImage+EPM.cc53
-rw-r--r--public/frameworks/DiskImage.fwrk/src/DiskImage+NeFS.cc (renamed from public/frameworks/DiskImage.fwrk/src/DiskImage.cc)46
-rw-r--r--public/frameworks/KernelTest.fwrk/headers/KernelTest.h26
-rw-r--r--public/tools/diutil/src/CommandLine.cc6
35 files changed, 236 insertions, 204 deletions
diff --git a/dev/boot/BootKit/BootKit.h b/dev/boot/BootKit/BootKit.h
index b5062eab..759b0d94 100644
--- a/dev/boot/BootKit/BootKit.h
+++ b/dev/boot/BootKit/BootKit.h
@@ -14,7 +14,7 @@
#include <BootKit/HW/ATA.h>
#include <FirmwareKit/EPM.h>
#include <CompilerKit/Version.h>
-#include <modules/CoreGfx/FBMgr.h>
+#include <modules/CoreGfx/CoreGfx.h>
#include <BootKit/Rsrc/zka_disk.rsrc>
#include <BootKit/Rsrc/zka_no_disk.rsrc>
#include <BootKit/Rsrc/zka_has_disk.rsrc>
diff --git a/dev/boot/BootKit/Qr.h b/dev/boot/BootKit/Qr.h
index 760d8b7f..61ae2234 100644
--- a/dev/boot/BootKit/Qr.h
+++ b/dev/boot/BootKit/Qr.h
@@ -5,7 +5,7 @@
#include <BootKit/Shared/bit.h>
#include <BootKit/QrPrelude.h>
-#include <modules/CoreGfx/FBMgr.h>
+#include <modules/CoreGfx/CoreGfx.h>
#include <BootKit/Support.h>
#include <CompilerKit/Detail.h>
diff --git a/dev/boot/amd64-ci.make b/dev/boot/amd64-ci.make
index 21c797f6..3c7c6527 100644
--- a/dev/boot/amd64-ci.make
+++ b/dev/boot/amd64-ci.make
@@ -17,7 +17,7 @@ ifneq ($(findstring CYGWIN_NT-10.0,$(shell uname)), )
EMU=qemu-system-x86_64w.exe
else
# this for NT distributions
-EMU=qemu-system-x86_64 -net none
+EMU=qemu-system-x86_64
endif
ifeq ($(NEOS_MODEL), )
@@ -49,16 +49,16 @@ DEBUG_MACRO = -D__DEBUG__
endif
ifeq ($(shell uname), Darwin)
-EMU_FLAGS=-M q35 -net none -smp 4 -m 8G \
+EMU_FLAGS=-M q35 -smp 4 -m 8G \
-bios $(BIOS) -cdrom $(BOOT) -boot d
endif
ifneq ($(shell uname), Darwin)
-EMU_FLAGS=-net none -smp 4 -m 8G \
+EMU_FLAGS= -smp 4 -m 8G \
-bios $(BIOS) -M q35 -cdrom $(BOOT) -boot d -accel kvm
endif
-LD_FLAGS=-e Main --subsystem=10
+LD_FLAGS=-e ModuleMain --subsystem=10
STANDALONE_MACRO=-D__BOOTZ_STANDALONE__
OBJ=obj/*.o
diff --git a/dev/boot/amd64-desktop.make b/dev/boot/amd64-desktop.make
index 95ccac2e..b0f81a39 100644
--- a/dev/boot/amd64-desktop.make
+++ b/dev/boot/amd64-desktop.make
@@ -17,7 +17,7 @@ ifneq ($(findstring CYGWIN_NT-10.0,$(shell uname)), )
EMU=qemu-system-x86_64w.exe
else
# this for NT distributions
-EMU=qemu-system-x86_64 -net none
+EMU=qemu-system-x86_64
endif
ifeq ($(NEOS_MODEL), )
@@ -49,16 +49,16 @@ DEBUG_MACRO = -D__DEBUG__
endif
ifeq ($(shell uname), Darwin)
-EMU_FLAGS=-M q35 -net none -smp 4 -m 8G \
+EMU_FLAGS=-M q35 -smp 4 -m 8G \
-bios $(BIOS) -cdrom $(BOOT) -boot d
endif
ifneq ($(shell uname), Darwin)
-EMU_FLAGS=-net none -smp 4 -m 8G \
+EMU_FLAGS= -smp 4 -m 8G \
-bios $(BIOS) -M q35 -cdrom $(BOOT) -boot d -accel kvm
endif
-LD_FLAGS=-e Main --subsystem=10
+LD_FLAGS=-e ModuleMain --subsystem=10
STANDALONE_MACRO=-D__BOOTZ_STANDALONE__
OBJ=obj/*.o
diff --git a/dev/boot/arm64-desktop.make b/dev/boot/arm64-desktop.make
index a862b5b8..a553e908 100644
--- a/dev/boot/arm64-desktop.make
+++ b/dev/boot/arm64-desktop.make
@@ -27,14 +27,14 @@ IMG=epm-master-1.img
IMG_2=epm-slave.img
IMG_3=epm-master-2.img
-EMU_FLAGS=-net none -smp 4 -m 8G -cpu max -M virt \
+EMU_FLAGS= -smp 4 -m 8G -cpu max -M virt \
-bios $(BIOS) \
-drive id=disk,file=$(IMG),format=raw,if=none \
-drive \
file=fat:rw:src/root/,index=2,format=raw \
-no-shutdown -no-reboot -cpu cortex-a72 -device virtio-gpu-pci
-LD_FLAGS=-subsystem:efi_application -entry:Main /nodefaultlib
+LD_FLAGS=-subsystem:efi_application -entry:ModuleMain /nodefaultlib
STANDALONE_MACRO=-D__BOOTZ_STANDALONE__
OBJ=*.o
diff --git a/dev/boot/gdbinit b/dev/boot/gdbinit
index 9522f6e8..e5b29f38 100644
--- a/dev/boot/gdbinit
+++ b/dev/boot/gdbinit
@@ -1,3 +1,3 @@
set disassemble-next-line on
-b Main
+b ModuleMain
target remote localhost:1234
diff --git a/dev/boot/modules/BootNet/BootNet.cc b/dev/boot/modules/BootNet/BootNet.cc
index 1129ef30..2396852f 100644
--- a/dev/boot/modules/BootNet/BootNet.cc
+++ b/dev/boot/modules/BootNet/BootNet.cc
@@ -11,6 +11,8 @@
#include <BootKit/BootKit.h>
#include <BootKit/BootThread.h>
+EfiGUID kEfiIP4ProtoGUID;
+
EXTERN_C Int32 ModuleMain(Kernel::HEL::BootInfoHeader* handover)
{
BOOTNET_INTERNET_HEADER inet{};
@@ -22,7 +24,7 @@ EXTERN_C Int32 ModuleMain(Kernel::HEL::BootInfoHeader* handover)
if (inet.Length < 1)
{
Boot::BootTextWriter writer;
- writer.Write("BootNetLauncher: No executable attached to the packet, aborting.\r");
+ writer.Write("BootNet: No executable attached to the packet, aborting.\r");
return kEfiFail;
}
diff --git a/dev/boot/modules/SysChk/SysChk.cc b/dev/boot/modules/SysChk/SysChk.cc
index 2a814326..51b247a5 100644
--- a/dev/boot/modules/SysChk/SysChk.cc
+++ b/dev/boot/modules/SysChk/SysChk.cc
@@ -8,8 +8,8 @@
*/
#include <BootKit/BootKit.h>
-#include <modules/CoreGfx/FBMgr.h>
-#include <modules/CoreGfx/TextMgr.h>
+#include <modules/CoreGfx/CoreGfx.h>
+#include <modules/CoreGfx/TextGfx.h>
#include <FirmwareKit/EFI.h>
#include <FirmwareKit/EFI/API.h>
#include <FirmwareKit/Handover.h>
@@ -19,7 +19,7 @@
#include <NewKit/Macros.h>
#include <NewKit/Ref.h>
#include <BootKit/BootThread.h>
-#include <modules/CoreGfx/FBMgr.h>
+#include <modules/CoreGfx/CoreGfx.h>
EXTERN_C Int32 ModuleMain(Kernel::HEL::BootInfoHeader* handover)
{
diff --git a/dev/boot/src/BootFileReader.cc b/dev/boot/src/BootFileReader.cc
index 7fed58f0..1236b7f0 100644
--- a/dev/boot/src/BootFileReader.cc
+++ b/dev/boot/src/BootFileReader.cc
@@ -13,7 +13,7 @@
#include <BootKit/BootKit.h>
#include <FirmwareKit/Handover.h>
#include <FirmwareKit/EFI/API.h>
-#include <modules/CoreGfx/TextMgr.h>
+#include <modules/CoreGfx/TextGfx.h>
/// @file BootFileReader
/// @brief Bootloader File reader.
diff --git a/dev/boot/src/BootThread.cc b/dev/boot/src/BootThread.cc
index 4cd2c466..3341601a 100644
--- a/dev/boot/src/BootThread.cc
+++ b/dev/boot/src/BootThread.cc
@@ -13,7 +13,7 @@
#include <KernelKit/PE.h>
#include <KernelKit/MSDOS.h>
#include <CFKit/Utils.h>
-#include <modules/CoreGfx/TextMgr.h>
+#include <modules/CoreGfx/TextGfx.h>
/// @brief External boot services symbol.
EXTERN EfiBootServices* BS;
diff --git a/dev/boot/src/HEL/AMD64/BootEFI.cc b/dev/boot/src/HEL/AMD64/BootEFI.cc
index 5f89aae6..076055b9 100644
--- a/dev/boot/src/HEL/AMD64/BootEFI.cc
+++ b/dev/boot/src/HEL/AMD64/BootEFI.cc
@@ -5,8 +5,8 @@
------------------------------------------- */
#include <BootKit/BootKit.h>
-#include <modules/CoreGfx/FBMgr.h>
-#include <modules/CoreGfx/TextMgr.h>
+#include <modules/CoreGfx/CoreGfx.h>
+#include <modules/CoreGfx/TextGfx.h>
#include <FirmwareKit/EFI.h>
#include <FirmwareKit/EFI/API.h>
#include <FirmwareKit/Handover.h>
@@ -16,7 +16,7 @@
#include <NewKit/Macros.h>
#include <NewKit/Ref.h>
#include <BootKit/BootThread.h>
-#include <modules/CoreGfx/FBMgr.h>
+#include <modules/CoreGfx/CoreGfx.h>
// Makes the compiler shut up.
#ifndef kMachineModel
@@ -78,11 +78,11 @@ STATIC Bool boot_init_fb() noexcept
EfiGUID kEfiGlobalNamespaceVarGUID = {
0x8BE4DF61, 0x93CA, 0x11D2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C}};
-/// @brief Main EFI entrypoint.
+/// @brief ModuleMain EFI entrypoint.
/// @param image_handle Handle of this image.
/// @param sys_table The system table of it.
/// @return nothing, never returns.
-EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr image_handle,
+EFI_EXTERN_C EFI_API Int32 ModuleMain(EfiHandlePtr image_handle,
EfiSystemTable* sys_table)
{
InitEFI(sys_table); ///! Init the EFI library.
diff --git a/dev/boot/src/HEL/ARM64/BootEFI.cc b/dev/boot/src/HEL/ARM64/BootEFI.cc
index 6839c2ec..adce693e 100644
--- a/dev/boot/src/HEL/ARM64/BootEFI.cc
+++ b/dev/boot/src/HEL/ARM64/BootEFI.cc
@@ -5,8 +5,8 @@
------------------------------------------- */
#include <BootKit/BootKit.h>
-#include <modules/CoreGfx/FBMgr.h>
-#include <modules/CoreGfx/TextMgr.h>
+#include <modules/CoreGfx/CoreGfx.h>
+#include <modules/CoreGfx/TextGfx.h>
#include <FirmwareKit/EFI.h>
#include <FirmwareKit/EFI/API.h>
#include <FirmwareKit/Handover.h>
@@ -16,7 +16,7 @@
#include <NewKit/Macros.h>
#include <NewKit/Ref.h>
#include <BootKit/BootThread.h>
-#include <modules/CoreGfx/FBMgr.h>
+#include <modules/CoreGfx/CoreGfx.h>
// Makes the compiler shut up.
#ifndef kMachineModel
@@ -74,11 +74,11 @@ STATIC Bool boot_init_fb() noexcept
EXTERN EfiBootServices* BS;
-/// @brief Main EFI entrypoint.
+/// @brief ModuleMain EFI entrypoint.
/// @param image_handle Handle of this image.
/// @param sys_table The system table of it.
/// @return nothing, never returns.
-EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr image_handle,
+EFI_EXTERN_C EFI_API Int32 ModuleMain(EfiHandlePtr image_handle,
EfiSystemTable* sys_table)
{
InitEFI(sys_table); ///! Init the EFI library.
diff --git a/dev/kernel/FirmwareKit/EFI/API.h b/dev/kernel/FirmwareKit/EFI/API.h
index 67ff19bc..403e017e 100644
--- a/dev/kernel/FirmwareKit/EFI/API.h
+++ b/dev/kernel/FirmwareKit/EFI/API.h
@@ -22,7 +22,7 @@ class BootTextWriter;
#define __BOOTKIT_NO_INCLUDE__ 1
#include <BootKit/BootKit.h>
-#include <modules/CoreGfx/FBMgr.h>
+#include <modules/CoreGfx/CoreGfx.h>
#endif // ifdef __BOOTZ__
inline EfiSystemTable* ST = nullptr;
diff --git a/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc b/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc
index f839884e..10361d8e 100644
--- a/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc
+++ b/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc
@@ -11,7 +11,7 @@
#include <KernelKit/BinaryMutex.h>
#include <KernelKit/ProcessScheduler.h>
#include <KernelKit/Timer.h>
-#include <modules/CoreGfx/TextMgr.h>
+#include <modules/CoreGfx/TextGfx.h>
#include <NewKit/KernelPanic.h>
#include <KernelKit/HardwareThreadScheduler.h>
diff --git a/dev/kernel/HALKit/AMD64/HalDebugOutput.cc b/dev/kernel/HALKit/AMD64/HalDebugOutput.cc
index 9bd45efe..e79b6b09 100644
--- a/dev/kernel/HALKit/AMD64/HalDebugOutput.cc
+++ b/dev/kernel/HALKit/AMD64/HalDebugOutput.cc
@@ -8,8 +8,8 @@
#include <KernelKit/DebugOutput.h>
#include <NewKit/Utils.h>
#include <NewKit/New.h>
-#include <modules/CoreGfx/FBMgr.h>
-#include <modules/CoreGfx/TextMgr.h>
+#include <modules/CoreGfx/CoreGfx.h>
+#include <modules/CoreGfx/TextGfx.h>
namespace Kernel
{
diff --git a/dev/kernel/HALKit/AMD64/HalKernelMain.cc b/dev/kernel/HALKit/AMD64/HalKernelMain.cc
index 0371bde4..f4dbc16e 100644
--- a/dev/kernel/HALKit/AMD64/HalKernelMain.cc
+++ b/dev/kernel/HALKit/AMD64/HalKernelMain.cc
@@ -12,7 +12,7 @@
#include <modules/ACPI/ACPIFactoryInterface.h>
#include <NetworkKit/IPC.h>
#include <CFKit/Property.h>
-#include <modules/CoreGfx/TextMgr.h>
+#include <modules/CoreGfx/TextGfx.h>
EXTERN_C Kernel::VoidPtr kInterruptVectorTable[];
EXTERN_C Kernel::VoidPtr mp_user_switch_proc;
diff --git a/dev/kernel/HALKit/AMD64/HalKernelPanic.cc b/dev/kernel/HALKit/AMD64/HalKernelPanic.cc
index 770fac2b..3703692c 100644
--- a/dev/kernel/HALKit/AMD64/HalKernelPanic.cc
+++ b/dev/kernel/HALKit/AMD64/HalKernelPanic.cc
@@ -11,8 +11,8 @@
#include <NewKit/KString.h>
#include <FirmwareKit/Handover.h>
#include <KernelKit/FileMgr.h>
-#include <modules/CoreGfx/FBMgr.h>
-#include <modules/CoreGfx/TextMgr.h>
+#include <modules/CoreGfx/CoreGfx.h>
+#include <modules/CoreGfx/TextGfx.h>
#include <NewKit/Utils.h>
/* Each error code is attributed with an ID, which will prompt a string onto the
diff --git a/dev/kernel/HALKit/AMD64/HalUtils.asm b/dev/kernel/HALKit/AMD64/HalUtilsAPI.asm
index ab639992..ab639992 100644
--- a/dev/kernel/HALKit/AMD64/HalUtils.asm
+++ b/dev/kernel/HALKit/AMD64/HalUtilsAPI.asm
diff --git a/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc b/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
index 7dac018d..e5f10db3 100644
--- a/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
+++ b/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
@@ -77,16 +77,26 @@ STATIC Void drv_compute_disk_ahci() noexcept
static UInt8 identify_data[kSzIdent] ATTRIBUTE(aligned(4096)) = {0};
HAL::mm_map_page((void*)mib_cast(1), (void*)mib_cast(1), HAL::kMMFlagsWr);
-
+
rt_set_memory(identify_data, 0, kSzIdent);
/// Send AHCI command for identification.
drv_std_input_output_ahci<NO, YES, YES>(0, identify_data, kAHCISectorSize, kSzIdent);
/// Extract 48-bit LBA.
- kSATASectorCount = (identify_data[61] << 16) | identify_data[60];
+
+ UInt64 lba48_sectors = 0;
+ lba48_sectors |= (UInt64)identify_data[100];
+ lba48_sectors |= (UInt64)identify_data[101] << 16;
+ lba48_sectors |= (UInt64)identify_data[102] << 32;
+
+ if (lba48_sectors == 0)
+ kSATASectorCount = (identify_data[61] << 16) | identify_data[60];
+ else
+ kSATASectorCount = lba48_sectors;
/// Show what we got.
+
kout << "Disk Model: " << kCurrentDiskModel << kendl;
kout << "Disk Size: " << number(drv_get_size()) << kendl;
kout << "Disk Sector Count: " << number(kSATASectorCount) << kendl;
@@ -142,7 +152,7 @@ STATIC Void drv_std_input_output_ahci(UInt64 lba, UInt8* buffer, SizeT sector_sz
MUST_PASS(command_header);
- constexpr UInt32 kMaxPRDSize = 0x400000;
+ constexpr const UInt32 kMaxPRDSize = mib_cast(4);
command_header->Cfl = sizeof(FisRegH2D) / sizeof(UInt32);
command_header->Write = Write;
@@ -392,6 +402,71 @@ Bool drv_std_detected_ahci()
return kSATADev.DeviceId() != (UShort)PCI::PciConfigKind::Invalid && kSATADev.Bar(kSATABar5) != 0;
}
+// ================================================================================================
+
+//
+// This applies only if we compile with AHCI as a default disk driver.
+//
+
+// ================================================================================================
+
+#ifdef __AHCI__
+
+////////////////////////////////////////////////////
+///
+////////////////////////////////////////////////////
+Void drv_std_write(UInt64 lba, Char* buffer, SizeT sector_sz, SizeT size_buffer)
+{
+ drv_std_input_output_ahci<YES, YES, NO>(lba, reinterpret_cast<UInt8*>(buffer), sector_sz, size_buffer);
+}
+
+////////////////////////////////////////////////////
+///
+////////////////////////////////////////////////////
+Void drv_std_read(UInt64 lba, Char* buffer, SizeT sector_sz, SizeT size_buffer)
+{
+ drv_std_input_output_ahci<NO, YES, NO>(lba, reinterpret_cast<UInt8*>(buffer), sector_sz, size_buffer);
+}
+
+////////////////////////////////////////////////////
+///
+////////////////////////////////////////////////////
+Bool drv_std_init(UInt16& pi)
+{
+ BOOL atapi = NO;
+ return drv_std_init_ahci(pi, atapi);
+}
+
+////////////////////////////////////////////////////
+///
+////////////////////////////////////////////////////
+Bool drv_std_detected(Void)
+{
+ return drv_std_detected_ahci();
+}
+
+////////////////////////////////////////////////////
+/**
+ @brief Gets the number of sectors inside the drive.
+ @return Sector size in bytes.
+ */
+////////////////////////////////////////////////////
+SizeT drv_get_sector_count()
+{
+ return drv_get_sector_count_ahci();
+}
+
+////////////////////////////////////////////////////
+/// @brief Get the drive size.
+/// @return Disk size in bytes.
+////////////////////////////////////////////////////
+SizeT drv_get_size()
+{
+ return drv_get_size_ahci();
+}
+
+#endif // ifdef __AHCI__
+
namespace Kernel
{
/// @brief Initialize an AHCI device (StorageKit)
@@ -471,68 +546,3 @@ namespace Kernel
return ErrorOr<AHCIDeviceInterface>(device);
}
} // namespace Kernel
-
-// ================================================================================================
-
-//
-// This applies only if we compile with AHCI as a default disk driver.
-//
-
-// ================================================================================================
-
-#ifdef __AHCI__
-
-////////////////////////////////////////////////////
-///
-////////////////////////////////////////////////////
-Void drv_std_write(UInt64 lba, Char* buffer, SizeT sector_sz, SizeT size_buffer)
-{
- drv_std_input_output_ahci<YES, YES, NO>(lba, reinterpret_cast<UInt8*>(buffer), sector_sz, size_buffer);
-}
-
-////////////////////////////////////////////////////
-///
-////////////////////////////////////////////////////
-Void drv_std_read(UInt64 lba, Char* buffer, SizeT sector_sz, SizeT size_buffer)
-{
- drv_std_input_output_ahci<NO, YES, NO>(lba, reinterpret_cast<UInt8*>(buffer), sector_sz, size_buffer);
-}
-
-////////////////////////////////////////////////////
-///
-////////////////////////////////////////////////////
-Bool drv_std_init(UInt16& pi)
-{
- BOOL atapi = NO;
- return drv_std_init_ahci(pi, atapi);
-}
-
-////////////////////////////////////////////////////
-///
-////////////////////////////////////////////////////
-Bool drv_std_detected(Void)
-{
- return drv_std_detected_ahci();
-}
-
-////////////////////////////////////////////////////
-/**
- @brief Gets the number of sectors inside the drive.
- @return Sector size in bytes.
- */
-////////////////////////////////////////////////////
-SizeT drv_get_sector_count()
-{
- return drv_get_sector_count_ahci();
-}
-
-////////////////////////////////////////////////////
-/// @brief Get the drive size.
-/// @return Disk size in bytes.
-////////////////////////////////////////////////////
-SizeT drv_get_size()
-{
- return drv_get_size_ahci();
-}
-
-#endif // ifdef __AHCI__
diff --git a/dev/kernel/HALKit/ARM64/HalKernelMain.cc b/dev/kernel/HALKit/ARM64/HalKernelMain.cc
index 14781151..d9f3eb85 100644
--- a/dev/kernel/HALKit/ARM64/HalKernelMain.cc
+++ b/dev/kernel/HALKit/ARM64/HalKernelMain.cc
@@ -5,7 +5,7 @@
------------------------------------------- */
#include <ArchKit/ArchKit.h>
-#include <modules/CoreGfx/FBMgr.h>
+#include <modules/CoreGfx/CoreGfx.h>
#include <FirmwareKit/Handover.h>
#include <KernelKit/FileMgr.h>
#include <KernelKit/MemoryMgr.h>
diff --git a/dev/kernel/HALKit/ARM64/HalKernelPanic.cc b/dev/kernel/HALKit/ARM64/HalKernelPanic.cc
index 4a632564..1e008c0f 100644
--- a/dev/kernel/HALKit/ARM64/HalKernelPanic.cc
+++ b/dev/kernel/HALKit/ARM64/HalKernelPanic.cc
@@ -11,8 +11,8 @@
#include <NewKit/KString.h>
#include <FirmwareKit/Handover.h>
#include <KernelKit/FileMgr.h>
-#include <modules/CoreGfx/FBMgr.h>
-#include <modules/CoreGfx/TextMgr.h>
+#include <modules/CoreGfx/CoreGfx.h>
+#include <modules/CoreGfx/TextGfx.h>
#include <NewKit/Utils.h>
/* Each error code is attributed with an ID, which will prompt a string onto the
diff --git a/dev/kernel/KernelKit/Defines.h b/dev/kernel/KernelKit/Defines.h
index 9977462d..ca258f58 100644
--- a/dev/kernel/KernelKit/Defines.h
+++ b/dev/kernel/KernelKit/Defines.h
@@ -8,8 +8,8 @@
#include <NewKit/Defines.h>
-#define KERNELKIT_VERSION "1.0.2"
-#define KERNELKIT_VERSION_BCD 0x01020
+#define KERNELKIT_VERSION "0.0.1"
+#define KERNELKIT_VERSION_BCD 0x0001
class UserProcessScheduler;
class IDylibObject;
diff --git a/dev/kernel/NewKit/Defines.h b/dev/kernel/NewKit/Defines.h
index 85654a52..72e3c552 100644
--- a/dev/kernel/NewKit/Defines.h
+++ b/dev/kernel/NewKit/Defines.h
@@ -8,8 +8,8 @@
#include <NewKit/Macros.h>
-#define NEWKIT_VERSION_STR "1.1.0"
-#define NEWKIT_VERSION_BCD 0x01100
+#define NEWKIT_VERSION_STR "0.0.1"
+#define NEWKIT_VERSION_BCD 0x0001
#ifndef __cplusplus
#error Kernel compiles with a C++ compiler.
diff --git a/dev/kernel/amd64-ci.make b/dev/kernel/amd64-ci.make
index d71f3a6f..a03c8fdd 100644
--- a/dev/kernel/amd64-ci.make
+++ b/dev/kernel/amd64-ci.make
@@ -54,7 +54,7 @@ newos-amd64-epm: clean
$(ASM) $(ASMFLAGS) HALKit/AMD64/HalInterruptAPI.asm
$(ASM) $(ASMFLAGS) HALKit/AMD64/HalCommonAPI.asm
$(ASM) $(ASMFLAGS) HALKit/AMD64/HalBootHeader.asm
- $(ASM) $(ASMFLAGS) HALKit/AMD64/HalUtils.asm
+ $(ASM) $(ASMFLAGS) HALKit/AMD64/HalUtilsAPI.asm
$(MOVEALL)
OBJCOPY=x86_64-w64-mingw32-objcopy
diff --git a/dev/kernel/amd64-desktop.make b/dev/kernel/amd64-desktop.make
index d71f3a6f..a03c8fdd 100644
--- a/dev/kernel/amd64-desktop.make
+++ b/dev/kernel/amd64-desktop.make
@@ -54,7 +54,7 @@ newos-amd64-epm: clean
$(ASM) $(ASMFLAGS) HALKit/AMD64/HalInterruptAPI.asm
$(ASM) $(ASMFLAGS) HALKit/AMD64/HalCommonAPI.asm
$(ASM) $(ASMFLAGS) HALKit/AMD64/HalBootHeader.asm
- $(ASM) $(ASMFLAGS) HALKit/AMD64/HalUtils.asm
+ $(ASM) $(ASMFLAGS) HALKit/AMD64/HalUtilsAPI.asm
$(MOVEALL)
OBJCOPY=x86_64-w64-mingw32-objcopy
diff --git a/dev/kernel/src/Network/NetworkDevice.cc b/dev/kernel/src/Network/NetworkDevice.cc
index 79fb66d1..d7d78c28 100644
--- a/dev/kernel/src/Network/NetworkDevice.cc
+++ b/dev/kernel/src/Network/NetworkDevice.cc
@@ -10,25 +10,26 @@
namespace Kernel
{
/// \brief Getter for fNetworkName.
+ /// \return Network device name.
const Char* NetworkDevice::Name() const
{
return this->fNetworkName;
}
/// \brief Setter for fNetworkName.
- Boolean NetworkDevice::Name(const Char* devnam)
+ Boolean NetworkDevice::Name(const Char* name)
{
- if (devnam == nullptr)
+ if (name == nullptr)
return NO;
- if (*devnam == 0)
+ if (*name == 0)
return NO;
- if (rt_string_len(devnam) > cNetworkNameLen)
+ if (rt_string_len(name) > cNetworkNameLen)
return NO;
- rt_copy_memory((VoidPtr)devnam,
- (VoidPtr)this->fNetworkName, rt_string_len(devnam));
+ rt_copy_memory((VoidPtr)name,
+ (VoidPtr)this->fNetworkName, rt_string_len(name));
return YES;
}
diff --git a/dev/modules/CoreGfx/AccessibilityMgr.h b/dev/modules/CoreGfx/CoreAccess.h
index bacfef0b..adc9ed33 100644
--- a/dev/modules/CoreGfx/AccessibilityMgr.h
+++ b/dev/modules/CoreGfx/CoreAccess.h
@@ -9,8 +9,8 @@
#include <NewKit/NewKit.h>
#include <KernelKit/KPC.h>
-#include <modules/CoreGfx/FBMgr.h>
-#include <modules/CoreGfx/MathMgr.h>
+#include <modules/CoreGfx/CoreGfx.h>
+#include <modules/CoreGfx/MathGfx.h>
#include <ArchKit/ArchKit.h>
namespace FB
diff --git a/dev/modules/CoreGfx/FBMgr.h b/dev/modules/CoreGfx/CoreGfx.h
index 7ece4869..df22fed0 100644
--- a/dev/modules/CoreGfx/FBMgr.h
+++ b/dev/modules/CoreGfx/CoreGfx.h
@@ -130,7 +130,7 @@
#endif // __NE_AMD64__
#ifndef GFX_MGR_ACCESSIBILITY_H
-#include <modules/CoreGfx/AccessibilityMgr.h>
+#include <modules/CoreGfx/CoreAccess.h>
#endif // ifndef GFX_MGR_ACCESSIBILITY_H
namespace FB
diff --git a/dev/modules/CoreGfx/MathMgr.h b/dev/modules/CoreGfx/MathGfx.h
index 655903e2..655903e2 100644
--- a/dev/modules/CoreGfx/MathMgr.h
+++ b/dev/modules/CoreGfx/MathGfx.h
diff --git a/dev/modules/CoreGfx/TextMgr.h b/dev/modules/CoreGfx/TextGfx.h
index 12e02a28..13811d37 100644
--- a/dev/modules/CoreGfx/TextMgr.h
+++ b/dev/modules/CoreGfx/TextGfx.h
@@ -7,7 +7,7 @@
#pragma once
#include <NewKit/Defines.h>
-#include <modules/CoreGfx/FBMgr.h>
+#include <modules/CoreGfx/CoreGfx.h>
#define kFontSizeX 8
#define kFontSizeY 8
diff --git a/public/frameworks/DiskImage.fwrk/headers/DiskImage.h b/public/frameworks/DiskImage.fwrk/headers/DiskImage.h
index c20a12f8..1dc23c0a 100644
--- a/public/frameworks/DiskImage.fwrk/headers/DiskImage.h
+++ b/public/frameworks/DiskImage.fwrk/headers/DiskImage.h
@@ -22,27 +22,31 @@
#define kDIDiskNameLen (16)
#define kDIOutNameLen (256)
-/// @brief Disk Image file structure.
-/// @param disk_name Disk partition name.
-/// @param sector_sz Disk sector_sz.
-/// @param block_cnt Disk block count.
-/// @param disk_sz Disk size.
-/// @param out_name Output file name.
-struct DI_DISK_IMAGE
+namespace DI
{
- Char disk_name[kDIDiskNameLen] = kDIDefaultDiskName;
- SInt32 sector_sz = kDISectorSz;
- SInt32 block_cnt = 0;
- SizeT disk_sz = kDIMinDiskSz;
- Char out_name[kDIOutNameLen] = kDIDefaultOutputName;
-};
-
-/// @brief Format with an EPM partition.
-/// @param img disk image structure.
-/// @return Status code upon completion.
-SInt32 DIFormatPartitionEPM(struct DI_DISK_IMAGE& img) noexcept;
-
-/// @brief NeFS format over EPM.
-/// @param img disk image structure.
-/// @return Status code upon completion.
-SInt32 DIFormatFilesystemNeFS(struct DI_DISK_IMAGE& img) noexcept;
+ /// @brief Disk Image file structure.
+ /// @param disk_name Disk partition name.
+ /// @param sector_sz Disk sector_sz.
+ /// @param block_cnt Disk block count.
+ /// @param disk_sz Disk size.
+ /// @param out_name Output file name.
+ struct DI_DISK_IMAGE
+ {
+ Char disk_name[kDIDiskNameLen] = kDIDefaultDiskName;
+ SInt32 sector_sz = kDISectorSz;
+ SInt32 block_cnt = 0;
+ SizeT disk_sz = kDIMinDiskSz;
+ Char out_name[kDIOutNameLen] = kDIDefaultOutputName;
+ };
+
+ /// @brief Format with an EPM partition.
+ /// @param img disk image structure.
+ /// @return Status code upon completion.
+ SInt32 DIFormatPartitionEPM(struct DI_DISK_IMAGE& img) noexcept;
+
+ /// @brief NeFS format over EPM.
+ /// @param img disk image structure.
+ /// @return Status code upon completion.
+ SInt32 DIFormatFilesystemNeFS(struct DI_DISK_IMAGE& img) noexcept;
+
+} // namespace DI
diff --git a/public/frameworks/DiskImage.fwrk/src/DiskImage+EPM.cc b/public/frameworks/DiskImage.fwrk/src/DiskImage+EPM.cc
new file mode 100644
index 00000000..4d2a6694
--- /dev/null
+++ b/public/frameworks/DiskImage.fwrk/src/DiskImage+EPM.cc
@@ -0,0 +1,53 @@
+/* -------------------------------------------
+
+ Copyright (C) 2025, Amlal El Mahrouss, all rights reserved.
+
+ FILE: DiskImage+EPM.cc
+ PURPOSE: Disk Imaging framework.
+
+ ------------------------------------------- */
+
+#include <DiskImage.fwrk/headers/DiskImage.h>
+
+#include <FirmwareKit/EPM.h>
+#include <FSKit/NeFS.h>
+
+/// @brief EPM format disk
+/// @param img disk image structure.
+/// @return Status code upon completion.
+SInt32 DI::DIFormatPartitionEPM(struct DI_DISK_IMAGE& img) noexcept
+{
+ if (!img.sector_sz || (img.sector_sz % 512 != 0))
+ return kDIFailureStatus;
+
+ if (*img.out_name == 0 ||
+ *img.disk_name == 0)
+ return kDIFailureStatus;
+
+ struct ::EPM_PART_BLOCK block
+ {
+ };
+
+ block.NumBlocks = img.block_cnt;
+ block.SectorSz = img.sector_sz;
+ block.Version = kEPMRevisionBcd;
+ block.LbaStart = sizeof(struct ::EPM_PART_BLOCK);
+ block.LbaEnd = img.disk_sz - block.LbaStart;
+ block.FsVersion = kNeFSVersionInteger;
+
+ ::MmCopyMemory(block.Name, (VoidPtr)img.disk_name, ::MmStrLen(img.disk_name));
+ ::MmCopyMemory(block.Magic, (VoidPtr)kEPMMagic86, ::MmStrLen(kEPMMagic86));
+
+ IORef handle = IoOpenFile(img.out_name, nullptr);
+
+ if (!handle)
+ return kDIFailureStatus;
+
+ ::IoWriteFile(handle, (Char*)&block, sizeof(struct ::EPM_PART_BLOCK));
+
+ ::IoCloseFile(handle);
+
+ handle = nullptr;
+
+ return kDISuccessStatus;
+}
diff --git a/public/frameworks/DiskImage.fwrk/src/DiskImage.cc b/public/frameworks/DiskImage.fwrk/src/DiskImage+NeFS.cc
index 0c4ee06a..4928c878 100644
--- a/public/frameworks/DiskImage.fwrk/src/DiskImage.cc
+++ b/public/frameworks/DiskImage.fwrk/src/DiskImage+NeFS.cc
@@ -2,7 +2,7 @@
Copyright (C) 2025, Amlal El Mahrouss, all rights reserved.
- FILE: DiskImage.cc
+ FILE: DiskImage+NeFS.cc
PURPOSE: Disk Imaging framework.
------------------------------------------- */
@@ -12,50 +12,10 @@
#include <FirmwareKit/EPM.h>
#include <FSKit/NeFS.h>
-/// @brief EPM format disk
-/// @param img disk image structure.
-/// @return Status code upon completion.
-SInt32 DIFormatPartitionEPM(struct DI_DISK_IMAGE& img) noexcept
-{
- if (!img.sector_sz || (img.sector_sz % 512 != 0))
- return kDIFailureStatus;
-
- if (*img.out_name == 0 ||
- *img.disk_name == 0)
- return kDIFailureStatus;
-
- struct ::EPM_PART_BLOCK block
- {
- };
-
- block.NumBlocks = img.block_cnt;
- block.SectorSz = img.sector_sz;
- block.Version = kEPMRevisionBcd;
- block.LbaStart = sizeof(struct ::EPM_PART_BLOCK);
- block.LbaEnd = img.disk_sz - block.LbaStart;
- block.FsVersion = kNeFSVersionInteger;
-
- ::MmCopyMemory(block.Name, (VoidPtr)img.disk_name, ::MmStrLen(img.disk_name));
- ::MmCopyMemory(block.Magic, (VoidPtr)kEPMMagic86, ::MmStrLen(kEPMMagic86));
-
- IOObject handle = IoOpenFile(img.out_name, nullptr);
-
- if (!handle)
- return kDIFailureStatus;
-
- ::IoWriteFile(handle, (Char*)&block, sizeof(struct ::EPM_PART_BLOCK));
-
- ::IoCloseFile(handle);
-
- handle = nullptr;
-
- return kDISuccessStatus;
-}
-
/// @brief NeFS format over EPM.
/// @param img disk image structure.
/// @return Status code upon completion.
-SInt32 DIFormatFilesystemNeFS(struct DI_DISK_IMAGE& img) noexcept
+SInt32 DI::DIFormatFilesystemNeFS(struct DI_DISK_IMAGE& img) noexcept
{
if (!img.sector_sz || (img.sector_sz % 512 != 0))
return kDIFailureStatus;
@@ -85,7 +45,7 @@ SInt32 DIFormatFilesystemNeFS(struct DI_DISK_IMAGE& img) noexcept
rpb.FreeSectors = rpb.SectorCount;
rpb.FreeCatalog = rpb.DiskSize / sizeof(NEFS_CATALOG_STRUCT);
- IOObject handle = IoOpenFile(img.out_name, nullptr);
+ IORef handle = IoOpenFile(img.out_name, nullptr);
if (!handle)
return kDIFailureStatus;
diff --git a/public/frameworks/KernelTest.fwrk/headers/KernelTest.h b/public/frameworks/KernelTest.fwrk/headers/KernelTest.h
index c802574b..30fb3ce6 100644
--- a/public/frameworks/KernelTest.fwrk/headers/KernelTest.h
+++ b/public/frameworks/KernelTest.fwrk/headers/KernelTest.h
@@ -6,28 +6,30 @@
#pragma once
-#define NE_TEST_VERSION_BCD (0x0001)
-#define NE_TEST_VERSION "0.0.1"
+#include <NewKit/KernelPanic.h>
-#define NE_TEST_FAILURE (1)
+#define KT_TEST_VERSION_BCD (0x0001)
+#define KT_TEST_VERSION "0.0.1"
-#define NE_TEST_SUCCESS (0)
+#define KT_TEST_FAILURE (1)
-#define NE_DECL_TEST(NAME, FN) \
- class NAME final \
+#define KT_TEST_SUCCESS (0)
+
+#define KT_DECL_TEST(NAME, FN) \
+ class KT_##NAME final \
{ \
public: \
- int Run(); \
+ void Run(); \
const char* ToString(); \
}; \
- inline int NAME::Run() \
+ inline void KT_##NAME::Run() \
{ \
- return FN() == 0; \
+ MUST_PASS(FN() == true); \
} \
- inline const char* NAME::ToString() \
+ inline const char* KT_##NAME::ToString() \
{ \
return #FN; \
}
-NE_DECL_TEST(ALWAYS_BREAK, []() -> bool { return false; });
-NE_DECL_TEST(ALWAYS_GOOD, []() -> bool { return true; }); \ No newline at end of file
+KT_DECL_TEST(ALWAYS_BREAK, []() -> bool { return false; });
+KT_DECL_TEST(ALWAYS_GOOD, []() -> bool { return true; }); \ No newline at end of file
diff --git a/public/tools/diutil/src/CommandLine.cc b/public/tools/diutil/src/CommandLine.cc
index d05b6e3a..61154e7a 100644
--- a/public/tools/diutil/src/CommandLine.cc
+++ b/public/tools/diutil/src/CommandLine.cc
@@ -54,7 +54,7 @@ int main(int argc, char** argv)
// create disk image.
- DI_DISK_IMAGE img{};
+ DI::DI_DISK_IMAGE img{};
img.disk_sz = kDiskSz;
img.sector_sz = kDiskSectorSz;
@@ -63,6 +63,6 @@ int main(int argc, char** argv)
MmCopyMemory((VoidPtr)img.disk_name, (VoidPtr)kDiskName, kDIDiskNameLen);
MmCopyMemory((VoidPtr)img.out_name, (VoidPtr)kOutDisk, kDIDiskNameLen);
- // format disk image.
- return DIFormatPartitionEPM(img);
+ // format disk image to explicit partition map.
+ return DI::DIFormatPartitionEPM(img);
} \ No newline at end of file