diff options
| -rw-r--r-- | Private/NewBoot/BootKit/BootKit.hxx | 9 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootMain.cxx | 1 | ||||
| -rw-r--r-- | Private/NewBoot/Source/makefile | 2 | ||||
| -rw-r--r-- | Private/NewKit/Macros.hpp | 8 |
4 files changed, 15 insertions, 5 deletions
diff --git a/Private/NewBoot/BootKit/BootKit.hxx b/Private/NewBoot/BootKit/BootKit.hxx index c8333b86..faba02fb 100644 --- a/Private/NewBoot/BootKit/BootKit.hxx +++ b/Private/NewBoot/BootKit/BootKit.hxx @@ -313,6 +313,15 @@ inline Boolean BDiskFormatFactory<BootDev>::Format(const char* partName, /// @note A catalog roughly equal to a sector. + constexpr auto cMinimumDiskSize = 10; // at minimum. + + /// @note also look at EPM headers, for free part blocks. + + if (GIB(fDiskDev.GetDiskSize()) < cMinimumDiskSize) { + EFI::ThrowError(L"Disk-Too-Tiny", L"Disk can't contain a New Filesystem partition."); + return false; + } + partBlock->Version = kNewFSVersionInteger; partBlock->CatalogCount = blobCount; partBlock->Kind = kNewFSHardDrive; diff --git a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx index e0e37b7d..5bc55a47 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx @@ -86,6 +86,7 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, volatile Char* vendorTable = reinterpret_cast<volatile Char*>( SystemTable->ConfigurationTable[indexVT].VendorTable); + /// ACPI's 'RSD PTR', which contains hardware tables (MADT, FACP...) if (vendorTable[0] == 'R' && vendorTable[1] == 'S' && vendorTable[2] == 'D' && vendorTable[3] == ' ' && vendorTable[4] == 'P' && vendorTable[5] == 'T' && diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile index b5ee849d..15412436 100644 --- a/Private/NewBoot/Source/makefile +++ b/Private/NewBoot/Source/makefile @@ -76,7 +76,7 @@ run-efi-amd64: # img_2 is the rescue disk. img is the bootable disk, as provided by the NeWS. .PHONY: epm-img epm-img: - qemu-img create -f raw $(IMG) 20G + qemu-img create -f raw $(IMG) 10G qemu-img create -f raw $(IMG_2) 512M .PHONY: download-edk diff --git a/Private/NewKit/Macros.hpp b/Private/NewKit/Macros.hpp index f2094c87..6fe25fdf 100644 --- a/Private/NewKit/Macros.hpp +++ b/Private/NewKit/Macros.hpp @@ -7,19 +7,19 @@ #pragma once #ifndef KIB -#define KIB(X) ((X) << 10) +#define KIB(X) ((X) / 1024) #endif #ifndef MIB -#define MIB(X) ((UInt64)KIB(X) << 20) +#define MIB(X) ((UInt64)KIB(X) / 1024) #endif #ifndef GIB -#define GIB(X) ((UInt64)MIB(X) << 30) +#define GIB(X) ((UInt64)MIB(X) / 1024) #endif #ifndef TIB -#define TIB(X) ((UInt64)GIB(X) << 40) +#define TIB(X) ((UInt64)GIB(X) / 1024) #endif #ifndef ARRAY_SIZE |
