From 2a7a9825fd275d6d999b94614fe87c1d705c7f8f Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 1 Apr 2025 08:30:44 +0200 Subject: boot, kernel, modules: unify gfx headers, fix AHCI LBA48, standardize ModuleMain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Consolidated CoreGfx headers: * Renamed `FBMgr.h` to `CoreGfx.h` * Renamed `TextMgr.h` → `TextGfx.h`, `MathMgr.h` → `MathGfx.h`, and `AccessibilityMgr.h` → `CoreAccess.h` * Updated all includes across bootloader, HAL, and kernel to use new names - Standardized EFI entrypoint: * Replaced `Main` with `ModuleMain` in EFI boot sources and linker flags * Updated GDB and build scripts accordingly - Improved AHCI identify logic: * Added full 48-bit LBA extraction (words 100–102) * Fallback to 28-bit if LBA48 not supported * Refactored `drv_get_size` and `drv_std_detected` into separate `#ifdef __AHCI__` region - DiskImage framework improvements: * Namespaced API into `DI` namespace * Split implementation: `DiskImage+EPM.cc` and `DiskImage+NeFS.cc` * Updated CLI tool accordingly - KernelTest framework: * Namespaced macros and classes with `KT_` * Changed test result to use `MUST_PASS` and boolean return - Misc: * Corrected minor logic in `NetworkDevice::Name()` * Bumped down KernelKit and NewKit versions to 0.0.1 * Renamed `HalUtils.asm` → `HalUtilsAPI.asm` Signed-off-by: Amlal El Mahrouss --- dev/boot/BootKit/BootKit.h | 2 +- dev/boot/BootKit/Qr.h | 2 +- dev/boot/amd64-ci.make | 8 ++++---- dev/boot/amd64-desktop.make | 8 ++++---- dev/boot/arm64-desktop.make | 4 ++-- dev/boot/gdbinit | 2 +- dev/boot/modules/BootNet/BootNet.cc | 4 +++- dev/boot/modules/SysChk/SysChk.cc | 6 +++--- dev/boot/src/BootFileReader.cc | 2 +- dev/boot/src/BootThread.cc | 2 +- dev/boot/src/HEL/AMD64/BootEFI.cc | 10 +++++----- dev/boot/src/HEL/ARM64/BootEFI.cc | 10 +++++----- 12 files changed, 31 insertions(+), 29 deletions(-) (limited to 'dev/boot') 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 #include #include -#include +#include #include #include #include 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 #include -#include +#include #include #include 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 #include +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 -#include -#include +#include +#include #include #include #include @@ -19,7 +19,7 @@ #include #include #include -#include +#include 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 #include #include -#include +#include /// @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 #include #include -#include +#include /// @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 -#include -#include +#include +#include #include #include #include @@ -16,7 +16,7 @@ #include #include #include -#include +#include // 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 -#include -#include +#include +#include #include #include #include @@ -16,7 +16,7 @@ #include #include #include -#include +#include // 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. -- cgit v1.2.3