summaryrefslogtreecommitdiffhomepage
path: root/Private/NewBoot/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Private/NewBoot/Source')
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/BootATA.cxx13
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/BootFileReader.cxx2
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/BootMain.cxx4
3 files changed, 13 insertions, 6 deletions
diff --git a/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx b/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx
index 41ea04ac..4bf7bc96 100644
--- a/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx
@@ -237,15 +237,20 @@ SizeT BootDeviceATA::GetDiskSize() noexcept {
boot_ata_wait_io(this->Leak().mBus);
- SizeT result = 0;
+ UInt64 result = 0;
- result += In8(this->Leak().mBus + ATA_CYL_LOW);
+ result = In8(this->Leak().mBus + ATA_CYL_LOW);
result += In8(this->Leak().mBus + ATA_CYL_MID) << 8;
result += In8(this->Leak().mBus + ATA_CYL_HIGH) << 16;
- result += In8(this->Leak().mBus + ATA_CYL_HIGH) << 24;
+
+ Out8(this->Leak().mBus + ATA_REG_CONTROL, 0x80);
+
+ result += In8(this->Leak().mBus + ATA_CYL_LOW) << 24;
+ result += In8(this->Leak().mBus + ATA_CYL_MID) << 32;
+ result += In8(this->Leak().mBus + ATA_CYL_HIGH) << 40;
BTextWriter writer;
- writer.Write(L"Disk-Size: ").Write(result).Write(L"\r\n");
+ writer.Write(L"Device-Size: ").Write(result).Write(L"\r\n");
return result;
}
diff --git a/Private/NewBoot/Source/HEL/AMD64/BootFileReader.cxx b/Private/NewBoot/Source/HEL/AMD64/BootFileReader.cxx
index 0e126ada..b2d728ae 100644
--- a/Private/NewBoot/Source/HEL/AMD64/BootFileReader.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/BootFileReader.cxx
@@ -110,7 +110,7 @@ Void BFileReader::ReadAll(SizeT until, SizeT chunk) {
if (auto err = BS->AllocatePool(EfiLoaderCode, until, (VoidPtr*)&mBlob) !=
kEfiOk) {
mWriter.Write(L"*** EFI-Code: ").Write(err).Write(L" ***\r\n");
- EFI::ThrowError(L"NewBoot_PageError", L"Allocation error.");
+ EFI::ThrowError(L"OutOfMemory", L"Allocation error.");
}
}
diff --git a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx
index a928a41a..1c969b28 100644
--- a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx
@@ -181,9 +181,11 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle,
/// format the disk.
//
+ constexpr auto binarySize = KIB(512);
+
/// need this as well, to invoke BExecutableLoader.
BFileReader readerKernel(L"NewKernel.exe", ImageHandle);
- readerKernel.ReadAll(MIB(1), 4096);
+ readerKernel.ReadAll(binarySize, BootDeviceATA::kSectorSize);
BDiskFormatFactory<BootDeviceATA> diskFormatter;