:: commit 36fa6291bdf00da5ffb473e732674b21c3ec8acf

mintsuki <mintsuki@protonmail.com> — 2021-07-06 01:17

parents: 449df1d547

pmm: Optimise get_raw_memmap()

diff --git a/README.md b/README.md
index c9357df2..8072e937 100644
--- a/README.md
+++ b/README.md
@@ -17,8 +17,8 @@ Like Limine and want to support it? Donate Bitcoin to `bc1q00d59y75crpapw7qp8sea
 ### Supported boot protocols
 * Linux
 * stivale and stivale2 (Limine's native boot protocols, see [their specifications](https://github.com/stivale/stivale) for details)
-* Chainloading
 * Multiboot 1
+* Chainloading
 
 ### Supported filesystems
 * ext2/3/4
diff --git a/stage23/mm/pmm.s2.c b/stage23/mm/pmm.s2.c
index cd2f8a7e..bfc377aa 100644
--- a/stage23/mm/pmm.s2.c
+++ b/stage23/mm/pmm.s2.c
@@ -359,19 +359,8 @@ void pmm_release_uefi_mem(void) {
 
 #if defined (bios)
 struct e820_entry_t *get_raw_memmap(size_t *entry_count) {
-    size_t mmap_count = e820_entries;
-    size_t mmap_len = mmap_count * sizeof(struct e820_entry_t);
-
-    struct e820_entry_t *mmap = conv_mem_alloc(mmap_len);
-
-    for (size_t i = 0; i < mmap_count; i++) {
-        mmap[i].base   = e820_map[i].base;
-        mmap[i].length = e820_map[i].length;
-        mmap[i].type   = e820_map[i].type;
-    }
-
-    *entry_count = mmap_count;
-    return mmap;
+    *entry_count = e820_entries;
+    return e820_map;
 }
 #endif
 
@@ -380,7 +369,7 @@ struct e820_entry_t *get_raw_memmap(size_t *entry_count) {
     size_t mmap_count = efi_mmap_size / efi_desc_size;
     size_t mmap_len = mmap_count * sizeof(struct e820_entry_t);
 
-    struct e820_entry_t *mmap = conv_mem_alloc(mmap_len);
+    struct e820_entry_t *mmap = ext_mem_alloc(mmap_len);
 
     for (size_t i = 0; i < mmap_count; i++) {
         EFI_MEMORY_DESCRIPTOR *entry = (void *)efi_mmap + i * efi_desc_size;
tab: 248 wrap: offon