diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-22 01:34:33 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-22 01:34:33 +0100 |
| commit | 6f1aa4288c62580afb876fb9e35a45d022027d1d (patch) | |
| tree | 5017c3d2619853c3bb7ffee17525443324acc3c2 /Private | |
| parent | d091afe4f669e5f0fe60736575ff0838c512279e (diff) | |
NewBoot: Fetching ACPI RSDPTR with success now.
This table is needed to implement AHCI.
Diffstat (limited to 'Private')
| -rw-r--r-- | Private/CompilerKit/Version.hxx | 4 | ||||
| -rw-r--r-- | Private/Executives/.gitkeep | 0 | ||||
| -rw-r--r-- | Private/Executives/Logon/.gitkeep | 0 | ||||
| -rw-r--r-- | Private/FirmwareKit/Handover.hxx | 2 | ||||
| -rw-r--r-- | Private/NewBoot/Source/CDROM/.HCORE | 2 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootMain.cxx | 47 | ||||
| -rw-r--r-- | Private/NewBoot/Source/makefile | 7 | ||||
| -rw-r--r-- | Private/makefile | 1 |
8 files changed, 36 insertions, 27 deletions
diff --git a/Private/CompilerKit/Version.hxx b/Private/CompilerKit/Version.hxx index 5c1e3bd0..d21cc80f 100644 --- a/Private/CompilerKit/Version.hxx +++ b/Private/CompilerKit/Version.hxx @@ -1,4 +1,4 @@ #pragma once -#define BOOTLOADER_VERSION L"v1.14.0" -#define KERNEL_VERSION "v1.14.0" +#define BOOTLOADER_VERSION L"v1.14.1" +#define KERNEL_VERSION "v1.14.1" diff --git a/Private/Executives/.gitkeep b/Private/Executives/.gitkeep deleted file mode 100644 index e69de29b..00000000 --- a/Private/Executives/.gitkeep +++ /dev/null diff --git a/Private/Executives/Logon/.gitkeep b/Private/Executives/Logon/.gitkeep deleted file mode 100644 index e69de29b..00000000 --- a/Private/Executives/Logon/.gitkeep +++ /dev/null diff --git a/Private/FirmwareKit/Handover.hxx b/Private/FirmwareKit/Handover.hxx index cdf7d896..be308e13 100644 --- a/Private/FirmwareKit/Handover.hxx +++ b/Private/FirmwareKit/Handover.hxx @@ -68,7 +68,7 @@ struct HandoverInformationHeader { WideChar f_FirmwareVendorName[32]; SizeT f_FirmwareVendorLen; struct { - VoidPtr f_VendorTables; + VoidPtr f_VendorTable; } f_HardwareTables; struct { UIntPtr f_The; diff --git a/Private/NewBoot/Source/CDROM/.HCORE b/Private/NewBoot/Source/CDROM/.HCORE new file mode 100644 index 00000000..d5d2badf --- /dev/null +++ b/Private/NewBoot/Source/CDROM/.HCORE @@ -0,0 +1,2 @@ +[POWER_MANAGEMENT] +ENFORCE_ACPI=YES
\ No newline at end of file diff --git a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx index a45d12e4..572e8f5e 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx @@ -15,12 +15,7 @@ #error This CPU is unknown. #endif // ifdef __x86_64__ -#ifndef kBootKrnlSections -#error[NewBoot/NewBoot] Please provide the amount of sections the kernel has. -#endif // !kBootKrnlSections - -#define kBootReadSize \ - (sizeof(DosHeader) + sizeof(ExecHeader) + sizeof(ExecOptionalHeader)) +#define kMaxBufSize 256 EXTERN_C void Main(HEL::HandoverInformationHeader* HIH); @@ -39,12 +34,6 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle, .Write(BVersionString::Shared()) .Write(L"\r\n"); - const char strDate[] = __DATE__; - - writer.Write(L"NewBoot: Build: "); - - for (auto& ch : strDate) writer.WriteCharacter(ch); - writer.Write(L"\r\nNewBoot: Firmware Vendor: ") .Write(SystemTable->FirmwareVendor) .Write(L"\r\n"); @@ -53,11 +42,12 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle, BFileReader kernelImg(L".HCORE", ImageHandle); - kernelImg.Size(kBootReadSize + sizeof(ExecSectionHeader) * kBootKrnlSections); + kernelImg.Size(kMaxBufSize); kernelImg.ReadAll(); if (kernelImg.Error() == BFileReader::kOperationOkay) { - // first check for kernel.cfg inside ESP/EPM. + // First check for a kernel.cfg inside the ESP. + // This will tell us about the current kernel. BFileReader systemManifest(L".MANIFEST", ImageHandle); systemManifest.Size(1); @@ -103,10 +93,6 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle, L"GetMemoryMap returned a value which isn't kEfiOk!"); } -#ifndef __DEBUG__ - ST->ConOut->ClearScreen(ST->ConOut); -#endif - HEL::HandoverInformationHeader* handoverHdrPtr = nullptr; BS->AllocatePool(EfiLoaderData, sizeof(HEL::HandoverInformationHeader), @@ -133,12 +119,31 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle, BCopyMem(handoverHdrPtr->f_FirmwareVendorName, SystemTable->FirmwareVendor, handoverHdrPtr->f_FirmwareVendorLen); - handoverHdrPtr->f_HardwareTables.f_VendorTables = - ST->ConfigurationTable->VendorTable; + writer.Write(L"NewBoot: Fetch ACPI's 'RSD PTR'...").Write(L"\r\n"); + + for (SizeT indexVT = 0; indexVT < SystemTable->NumberOfTableEntries; ++indexVT) + { + volatile Char* vendorTable = reinterpret_cast<volatile Char*>(SystemTable->ConfigurationTable[indexVT].VendorTable); + + if (vendorTable[0] == 'R' && + vendorTable[1] == 'S' && + vendorTable[2] == 'D' && + vendorTable[3] == ' ' && + vendorTable[4] == 'P' && + vendorTable[5] == 'T' && + vendorTable[6] == 'R' && + vendorTable[7] == ' ') { + handoverHdrPtr->f_HardwareTables.f_VendorTable = (VoidPtr)vendorTable; + writer.Write(L"NewBoot: Found ACPI's 'RSD PTR' table on this machine.").Write(L"\r\n"); + + break; + } + } EFI::ExitBootServices(MapKey, ImageHandle); - bool isIniNotFound = (systemManifest.Blob() == nullptr); + /// TODO: Set this to what we found inside NewFS partition. + bool isIniNotFound = true; if (isIniNotFound) { handoverHdrPtr->f_Magic = kHandoverMagic; diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile index d5490556..631550c9 100644 --- a/Private/NewBoot/Source/makefile +++ b/Private/NewBoot/Source/makefile @@ -16,6 +16,8 @@ else EMU=qemu-system-x86_64w.exe endif +EMU_FLAGS=-net none -smp 2 -m 4G -M q35 -bios OVMF.fd -drive file=fat:rw:CDROM,index=1,format=raw -serial stdio + LD_FLAGS=-e efi_main --subsystem=10 OBJ=$(wildcard *.o) $(wildcard ../../Objects/*.obj) $(wildcard HEL/AMD64/*.obj) @@ -23,7 +25,7 @@ REM=rm REM_FLAG=-f FLAG_ASM=-f win64 -FLAG_GNU=-fshort-wchar -DkBootKrnlSections=9 -mgeneral-regs-only -mno-red-zone -D__KERNEL__ -DEFI_FUNCTION_WRAPPER -I../ -I../../ -I./ -c -ffreestanding -fno-rtti -fno-exceptions -std=c++20 -D__HAVE_HCORE_APIS__ -D__HCORE__ -D__BOOTLOADER__ -I./ +FLAG_GNU=-fshort-wchar -mgeneral-regs-only -mno-red-zone -D__KERNEL__ -DEFI_FUNCTION_WRAPPER -I../ -I../../ -I./ -c -ffreestanding -fno-rtti -fno-exceptions -std=c++20 -D__HAVE_HCORE_APIS__ -D__HCORE__ -D__BOOTLOADER__ -I./ .PHONY: invalid-recipe invalid-recipe: @@ -34,7 +36,6 @@ bootloader-amd64: compile-amd64 $(LD_GNU) $(OBJ) $(LD_FLAGS) -o NewBoot.exe $(COPY) NewBoot.exe CDROM/EFI/BOOT/BOOTX64.EFI $(COPY) NewBoot.exe CDROM/EFI/BOOT/NEWBOOT.EFI - $(ADD_FILE) CDROM/.HCORE .PHONY: compile-amd64 compile-amd64: @@ -42,7 +43,7 @@ compile-amd64: .PHONY: run-efi-amd64 run-efi-amd64: - $(EMU) -net none -smp 2 -m 4G -M q35 -bios OVMF.fd -drive file=fat:rw:CDROM,index=1,format=raw -serial stdio + $(EMU) $(EMU_FLAGS) .PHONY: download-edk download-edk: diff --git a/Private/makefile b/Private/makefile index 56561324..b7424bad 100644 --- a/Private/makefile +++ b/Private/makefile @@ -40,6 +40,7 @@ OBJCOPY=x86_64-w64-mingw32-objcopy .PHONY: link-amd64-pc link-amd64-pc: $(LD) $(LDFLAGS) $(LDOBJ) -o $(KERNEL) + cp $(KERNEL) Root/Boot .PHONY: all all: h-core-amd64-pc link-amd64-pc |
