pmm: Optimise get_raw_memmap()

This commit is contained in:
mintsuki 2021-07-06 03:17:28 +02:00
parent 449df1d547
commit 36fa6291bd
2 changed files with 4 additions and 15 deletions

View File

@ -17,8 +17,8 @@ Like Limine and want to support it? Donate Bitcoin to `bc1q00d59y75crpapw7qp8sea
### Supported boot protocols ### Supported boot protocols
* Linux * Linux
* stivale and stivale2 (Limine's native boot protocols, see [their specifications](https://github.com/stivale/stivale) for details) * stivale and stivale2 (Limine's native boot protocols, see [their specifications](https://github.com/stivale/stivale) for details)
* Chainloading
* Multiboot 1 * Multiboot 1
* Chainloading
### Supported filesystems ### Supported filesystems
* ext2/3/4 * ext2/3/4

View File

@ -359,19 +359,8 @@ void pmm_release_uefi_mem(void) {
#if defined (bios) #if defined (bios)
struct e820_entry_t *get_raw_memmap(size_t *entry_count) { struct e820_entry_t *get_raw_memmap(size_t *entry_count) {
size_t mmap_count = e820_entries; *entry_count = e820_entries;
size_t mmap_len = mmap_count * sizeof(struct e820_entry_t); return e820_map;
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;
} }
#endif #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_count = efi_mmap_size / efi_desc_size;
size_t mmap_len = mmap_count * sizeof(struct e820_entry_t); 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++) { for (size_t i = 0; i < mmap_count; i++) {
EFI_MEMORY_DESCRIPTOR *entry = (void *)efi_mmap + i * efi_desc_size; EFI_MEMORY_DESCRIPTOR *entry = (void *)efi_mmap + i * efi_desc_size;