:: commit 6cdb9fff24673edc648a632d7563737263f1f0a3

mintsuki <mintsuki@protonmail.com> — 2020-11-23 23:19

parents: 5b9a43d684

pmm: Fix bug where align_entry() would return the wrong error value

diff --git a/limine-pxe.bin b/limine-pxe.bin
index ff180440..4c82a85e 100644
Binary files a/limine-pxe.bin and b/limine-pxe.bin differ
diff --git a/limine.bin b/limine.bin
index b04497a2..66ff18c0 100644
Binary files a/limine.bin and b/limine.bin differ
diff --git a/stage2.map b/stage2.map
index 6b046cfd..a7c97588 100644
Binary files a/stage2.map and b/stage2.map differ
diff --git a/stage2/mm/pmm.c b/stage2/mm/pmm.c
index 96cf18c0..f7878d57 100644
--- a/stage2/mm/pmm.c
+++ b/stage2/mm/pmm.c
@@ -47,7 +47,7 @@ void print_memmap(struct e820_entry_t *mm, size_t size) {
 
 static bool align_entry(uint64_t *base, uint64_t *length) {
     if (*length < PAGE_SIZE)
-        return -1;
+        return false;
 
     uint64_t orig_base = *base;
 
@@ -109,11 +109,8 @@ static void sanitise_entries(bool align_entries) {
             memmap[i].length = top - base;
         }
 
-        bool success = true;
-        if (align_entries)
-            success = align_entry(&memmap[i].base, &memmap[i].length);
-
-        if (!memmap[i].length || !success) {
+        if (!memmap[i].length
+         || (align_entries && !align_entry(&memmap[i].base, &memmap[i].length))) {
             // Eradicate from memmap
             for (size_t j = i; j < memmap_entries - 1; j++) {
                 memmap[j] = memmap[j+1];
tab: 248 wrap: offon