pmm: Increase the max size of the memory map
diff --git a/stage23/lib/blib.c b/stage23/lib/blib.c
index 747fb72c..f12ac2d1 100644
--- a/stage23/lib/blib.c
+++ b/stage23/lib/blib.c
@@ -182,7 +182,7 @@ bool efi_exit_boot_services(void) {
// Go through new EFI memmap and free up bootloader entries
size_t entry_count = efi_mmap_size / efi_desc_size;
- EFI_MEMORY_DESCRIPTOR *efi_copy = ext_mem_alloc(256 * efi_desc_size);
+ EFI_MEMORY_DESCRIPTOR *efi_copy = ext_mem_alloc(MEMMAP_MAX_ENTRIES * efi_desc_size);
size_t efi_copy_i = 0;
for (size_t i = 0; i < entry_count; i++) {
@@ -205,7 +205,7 @@ bool efi_exit_boot_services(void) {
new_entry->NumberOfPages = (untouched_memmap[j].base - base) / 4096;
efi_copy_i++;
- if (efi_copy_i == 256) {
+ if (efi_copy_i == MEMMAP_MAX_ENTRIES) {
panic("efi: New memory map exhausted");
}
new_entry = (void *)efi_copy + efi_copy_i * efi_desc_size;
@@ -234,7 +234,7 @@ bool efi_exit_boot_services(void) {
new_entry->NumberOfPages = untouched_memmap[j].length / 4096;
efi_copy_i++;
- if (efi_copy_i == 256) {
+ if (efi_copy_i == MEMMAP_MAX_ENTRIES) {
panic("efi: New memory map exhausted");
}
new_entry = (void *)efi_copy + efi_copy_i * efi_desc_size;
@@ -249,7 +249,7 @@ bool efi_exit_boot_services(void) {
}
efi_copy_i++;
- if (efi_copy_i == 256) {
+ if (efi_copy_i == MEMMAP_MAX_ENTRIES) {
panic("efi: New memory map exhausted");
}
}
diff --git a/stage23/mm/pmm.h b/stage23/mm/pmm.h
index c2c41faa..a63850cf 100644
--- a/stage23/mm/pmm.h
+++ b/stage23/mm/pmm.h
@@ -6,6 +6,8 @@
#include <stdbool.h>
#include <sys/e820.h>
+#define MEMMAP_MAX_ENTRIES 1024
+
#define MEMMAP_USABLE 1
#define MEMMAP_RESERVED 2
#define MEMMAP_ACPI_RECLAIMABLE 3
diff --git a/stage23/mm/pmm.s2.c b/stage23/mm/pmm.s2.c
index 86caabe7..0024f72c 100644
--- a/stage23/mm/pmm.s2.c
+++ b/stage23/mm/pmm.s2.c
@@ -12,7 +12,6 @@
#endif
#define PAGE_SIZE 4096
-#define MEMMAP_MAX_ENTRIES 384
#if bios == 1
extern symbol bss_end;
diff --git a/stage23/sys/e820.s2.c b/stage23/sys/e820.s2.c
index 03339457..5e1dcc15 100644
--- a/stage23/sys/e820.s2.c
+++ b/stage23/sys/e820.s2.c
@@ -8,7 +8,7 @@
#include <lib/print.h>
#include <mm/pmm.h>
-#define MAX_E820_ENTRIES 256
+#define MAX_E820_ENTRIES 512
struct e820_entry_t e820_map[MAX_E820_ENTRIES];
size_t e820_entries = 0;
