summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-04-26 11:00:27 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-04-26 11:00:27 +0200
commit72b014b98fab4a6f875648a4b7b42347f780067e (patch)
tree70c67f7dda0b429de9d2dc3747b488f59b8a9c16
parente9b93cb61f130c2b07bdc031a2487e27ca5333f1 (diff)
MHR-16: bug fix Write number method, as well as an improved partition
checker. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
-rw-r--r--Private/NewBoot/BootKit/BootKit.hxx10
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/BootTextWriter.cxx4
-rw-r--r--Private/NewBoot/Source/makefile2
3 files changed, 8 insertions, 8 deletions
diff --git a/Private/NewBoot/BootKit/BootKit.hxx b/Private/NewBoot/BootKit/BootKit.hxx
index 76bfbfb0..2d8b535d 100644
--- a/Private/NewBoot/BootKit/BootKit.hxx
+++ b/Private/NewBoot/BootKit/BootKit.hxx
@@ -229,12 +229,12 @@ public:
return false;
}
- if (blockPart->DiskSize != this->fDiskDev.GetDiskSize()) {
+ if (blockPart->DiskSize != this->fDiskDev.GetDiskSize() ||
+ blockPart->DiskSize < 1 ||
+ blockPart->SectorSize != BootDev::kSectorSize) {
EFI::ThrowError(L"Invalid-Disk-Geometry", L"Invalid disk geometry.");
- }
-
- if (blockPart->DiskSize < 1) {
- EFI::ThrowError(L"Invalid-Disk-Geometry", L"Invalid disk geometry.");
+ } else if (blockPart->PartitionName[0] == 0) {
+ EFI::ThrowError(L"Invalid-Partition-Name", L"Invalid disk partition.");
}
BTextWriter writer;
diff --git a/Private/NewBoot/Source/HEL/AMD64/BootTextWriter.cxx b/Private/NewBoot/Source/HEL/AMD64/BootTextWriter.cxx
index ff30ff95..fc91a02a 100644
--- a/Private/NewBoot/Source/HEL/AMD64/BootTextWriter.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/BootTextWriter.cxx
@@ -75,8 +75,8 @@ BTextWriter &BTextWriter::Write(const Long &x) {
BTextWriter &BTextWriter::_Write(const Long &x) {
#ifdef __DEBUG__
- int y = x / 16;
- int h = x % 16;
+ UInt64 y = (x > 0 ? x : -x) / 16;
+ UInt64 h = (x > 0 ? x : -x) % 16;
if (y) this->_Write(y);
diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile
index 4d8e1100..92128b02 100644
--- a/Private/NewBoot/Source/makefile
+++ b/Private/NewBoot/Source/makefile
@@ -70,7 +70,7 @@ run-efi-amd64:
.PHONY: epm-img
epm-img:
- qemu-img create -f qcow2 $(IMG) 1G
+ qemu-img create -f qcow2 $(IMG) 512M
qemu-img create -f qcow2 $(IMG_2) 512M
.PHONY: download-edk