From 0a2760d8a5ce09ae77cfc097ece4100579164f9d Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 11 Mar 2025 08:10:55 +0100 Subject: Many AHCI improvements and IPC tweaks. Signed-off-by: Amlal El Mahrouss --- dev/Boot/Mod/SysChk/amd64.json | 3 +-- dev/Boot/amd64-desktop.make | 17 ++++++++++------- dev/Boot/src/HEL/AMD64/BootEFI.cc | 18 ++++-------------- 3 files changed, 15 insertions(+), 23 deletions(-) (limited to 'dev/Boot') diff --git a/dev/Boot/Mod/SysChk/amd64.json b/dev/Boot/Mod/SysChk/amd64.json index dd6e141f..6a6a4de0 100644 --- a/dev/Boot/Mod/SysChk/amd64.json +++ b/dev/Boot/Mod/SysChk/amd64.json @@ -5,9 +5,8 @@ "sources_path": ["*.cc", "*.S", "../../src/HEL/AMD64/*.cc", "../../src/HEL/AMD64/*.S", "../../src/*.cc"], "output_name": "syschk.sys", "compiler_flags": [ - "-ffreestanding", "-nostdlib", - "-std=c++23", + "-std=c++20", "-fPIC", "-fno-rtti", "-fno-exceptions", diff --git a/dev/Boot/amd64-desktop.make b/dev/Boot/amd64-desktop.make index ae2a8aca..2c8c5321 100644 --- a/dev/Boot/amd64-desktop.make +++ b/dev/Boot/amd64-desktop.make @@ -49,7 +49,7 @@ DEBUG_MACRO = -D__DEBUG__ endif ifeq ($(shell uname), Darwin) -EMU_FLAGS=-net none -smp 4 -m 8G \ +EMU_FLAGS=-M q35 -net none -smp 4 -m 8G \ -bios $(BIOS) -cdrom $(BOOT) -boot d -drive \ file=fat:rw:src/Root/,index=3,format=raw endif @@ -94,11 +94,14 @@ all: compile-amd64 $(COPY) ./Mod/SysChk/$(SYSCHK) src/Root/$(SYSCHK) $(COPY) ../LibSCI/$(SCIKIT) src/Root/$(SCIKIT) $(COPY) src/$(BOOTLOADER) src/Root/$(BOOTLOADER) - xorriso -as mkisofs -R -r -J \ - -no-emul-boot -boot-load-size 4 -boot-info-table -hfsplus \ - -apm-block-size 2048 --efi-boot EFI/BOOT/BOOTX64.EFI \ - -efi-boot-part --efi-boot-image --protective-msdos-label \ - src/Root -o $(BOOT) + xorriso -as mkisofs \ + -iso-level 3 \ + -r -V NeOS \ + -J -joliet-long \ + -append_partition 2 0xef src/Root/EFI/BOOT/BOOTX64.EFI \ + -partition_cyl_align all \ + -o $(BOOT) \ + src/Root/ ifneq ($(DEBUG_SUPPORT), ) @@ -115,7 +118,7 @@ compile-amd64: .PHONY: run-efi-amd64-ahci run-efi-amd64-ahci: - $(EMU) $(EMU_FLAGS) -hda $(IMG) -s -S -trace ahci_* -boot menu=on + $(EMU) $(EMU_FLAGS) -drive id=disk,file=$(IMG),if=none -device ich9-ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0 -s -S -trace ahci_* -boot menu=on .PHONY: run-efi-amd64-ata-pio run-efi-amd64-ata-pio: diff --git a/dev/Boot/src/HEL/AMD64/BootEFI.cc b/dev/Boot/src/HEL/AMD64/BootEFI.cc index a0f4c05e..84a4a777 100644 --- a/dev/Boot/src/HEL/AMD64/BootEFI.cc +++ b/dev/Boot/src/HEL/AMD64/BootEFI.cc @@ -196,17 +196,8 @@ EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr image_handle, // Update handover file specific table and phyiscal start field. //-------------------------------------------------------------// - handover_hdr->f_BitMapStart = nullptr; /* Start of bitmap. */ - handover_hdr->f_BitMapSize = kHandoverBitMapSz; /* Size of bitmap. */ - - while (BS->AllocatePool(EfiLoaderData, handover_hdr->f_BitMapSize, &handover_hdr->f_BitMapStart) != kEfiOk) - { - if (handover_hdr->f_BitMapStart) - { - BS->FreePool(handover_hdr->f_BitMapStart); - handover_hdr->f_BitMapStart = nullptr; - } - } + handover_hdr->f_BitMapStart = (VoidPtr)struct_ptr[kDefaultMemoryMap].VirtualStart; /* Start of bitmap. */ + handover_hdr->f_BitMapSize = struct_ptr[kDefaultMemoryMap].NumberOfPages * sizeof(UIntPtr); /* Size of bitmap. */ handover_hdr->f_FirmwareCustomTables[0] = (VoidPtr)BS; handover_hdr->f_FirmwareCustomTables[1] = (VoidPtr)ST; @@ -224,6 +215,7 @@ EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr image_handle, { syschk_thread = new Boot::BootThread(reader_syschk.Blob()); syschk_thread->SetName("BootZ: System Recovery Check"); + syschk_thread->Start(handover_hdr, NO); } #ifndef __AHCI__ @@ -276,13 +268,11 @@ EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr image_handle, // Assign to global 'kHandoverHeader'. - WideChar kernel_path[256U] = {0}; + WideChar kernel_path[256U] = L"neoskrnl.exe"; UInt32 kernel_path_sz = 256U; if (ST->RuntimeServices->GetVariable(L"/props/boot_path", kEfiGlobalNamespaceVarGUID, nullptr, &kernel_path_sz, kernel_path) != kEfiOk) { - CopyMem(kernel_path, L"neoskrnl.exe", 13); - UInt32 attr = 0x00000001 | 0x00000002 | 0x00000004; ST->RuntimeServices->SetVariable(L"/props/boot_path", kEfiGlobalNamespaceVarGUID, &attr, &kernel_path_sz, kernel_path); } -- cgit v1.2.3