summaryrefslogtreecommitdiffhomepage
path: root/dev/boot/src
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-06-10 09:15:04 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-06-10 09:15:04 +0200
commitf0f5c992ff0216e2e33f84751d5a389ebfb017b8 (patch)
tree4b7c5412d1f1d3409c90d8398c7e8011427fec24 /dev/boot/src
parent98b47e78991d4cc7712e98e6dc1496aa0f0fcf38 (diff)
fix: better allocation system in BootZ (aarch, amd64)
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/boot/src')
-rw-r--r--dev/boot/src/HEL/AMD64/BootEFI.cc20
-rw-r--r--dev/boot/src/HEL/ARM64/BootEFI.cc9
2 files changed, 15 insertions, 14 deletions
diff --git a/dev/boot/src/HEL/AMD64/BootEFI.cc b/dev/boot/src/HEL/AMD64/BootEFI.cc
index 166e0169..24bee2dd 100644
--- a/dev/boot/src/HEL/AMD64/BootEFI.cc
+++ b/dev/boot/src/HEL/AMD64/BootEFI.cc
@@ -128,28 +128,28 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa
handover_hdr->f_BitMapStart = nullptr; /* Start of bitmap. */
handover_hdr->f_BitMapSize = kHandoverBitMapSz; /* Size of bitmap in bytes. */
- Int32 trials = 5 * 10000000;
+ kHandoverHeader->f_BitMapStart = nullptr; /* Start of bitmap. */
+ kHandoverHeader->f_BitMapSize = kHandoverBitMapSz; /* Size of bitmap in bytes. */
- writer.Write("BootZ: Welcome to BootZ.\r");
- writer.Write("BootZ: Allocating sufficient memory, trying 4GB...\r");
+ UInt16 trials = 5;
- while (BS->AllocatePool(EfiLoaderData, handover_hdr->f_BitMapSize,
- &handover_hdr->f_BitMapStart) != kEfiOk) {
+ while (BS->AllocatePool(EfiLoaderData, kHandoverHeader->f_BitMapSize,
+ &kHandoverHeader->f_BitMapStart) != kEfiOk) {
--trials;
if (!trials) {
writer.Write("BootZ: Unable to allocate sufficient memory, trying again with 2GB...\r");
- trials = 3 * 10000000;
+ trials = 3;
- handover_hdr->f_BitMapSize = kHandoverBitMapSz / 2; /* Size of bitmap in bytes. */
+ kHandoverHeader->f_BitMapSize = kHandoverBitMapSz / 2; /* Size of bitmap in bytes. */
- while (BS->AllocatePool(EfiLoaderData, handover_hdr->f_BitMapSize,
- &handover_hdr->f_BitMapStart) != kEfiOk) {
+ while (BS->AllocatePool(EfiLoaderData, kHandoverHeader->f_BitMapSize,
+ &kHandoverHeader->f_BitMapStart) != kEfiOk) {
--trials;
if (!trials) {
- writer.Write("BootZ: Unable to allocate sufficent memory, aborting...\r");
+ writer.Write("BootZ: Unable to allocate sufficient memory, aborting...\r");
Boot::Stop();
}
}
diff --git a/dev/boot/src/HEL/ARM64/BootEFI.cc b/dev/boot/src/HEL/ARM64/BootEFI.cc
index 44c6a778..12ace024 100644
--- a/dev/boot/src/HEL/ARM64/BootEFI.cc
+++ b/dev/boot/src/HEL/ARM64/BootEFI.cc
@@ -129,16 +129,17 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa
kHandoverHeader->f_BitMapStart = nullptr; /* Start of bitmap. */
kHandoverHeader->f_BitMapSize = kHandoverBitMapSz; /* Size of bitmap in bytes. */
- Int32 trials = 5 * 10000000;
+
+ UInt16 trials = 5;
while (BS->AllocatePool(EfiLoaderData, kHandoverHeader->f_BitMapSize,
&kHandoverHeader->f_BitMapStart) != kEfiOk) {
--trials;
if (!trials) {
- writer.Write("BootZ: Unable to allocate sufficent memory, trying again with 2GB...\r");
+ writer.Write("BootZ: Unable to allocate sufficient memory, trying again with 2GB...\r");
- trials = 3 * 10000000;
+ trials = 3;
kHandoverHeader->f_BitMapSize = kHandoverBitMapSz / 2; /* Size of bitmap in bytes. */
@@ -147,7 +148,7 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa
--trials;
if (!trials) {
- writer.Write("BootZ: Unable to allocate sufficent memory, aborting...\r");
+ writer.Write("BootZ: Unable to allocate sufficient memory, aborting...\r");
Boot::Stop();
}
}