Files
ClassicOS/kernel/memmap.c
vmttmv 4fa82854dd BL: Query and store e820 memory map
- bl stage 1: move gdt+pm setup to stage 2 (avoids mode switching)
- bl stage 2: at entry query e820 table from bios, then setup gdt+pm
- kernel/memmap: pad map entry to 24 bytes, as exported by bl
- kernel/memmap: map copy (gbowne1)
- Makefile: facilitate placing the memory map at a known location
- Update bl docs
2026-01-28 18:08:31 +02:00

19 lines
582 B
C

#include "memmap.h"
#define BOOTLOADER_MEMMAP_COUNT_ADDR MEMMAP_BASE
#define BOOTLOADER_MEMMAP_ADDR (MEMMAP_BASE + 4)
uint32_t get_memory_map(memory_map_entry_t *map, uint32_t max_entries) {
// Read the number of entries found by the bootloader
uint32_t entries_found = *(uint32_t*)BOOTLOADER_MEMMAP_COUNT_ADDR;
memory_map_entry_t *bios_data = (memory_map_entry_t*)BOOTLOADER_MEMMAP_ADDR;
uint32_t count = 0;
while (count < entries_found && count < max_entries) {
map[count] = bios_data[count];
count++;
}
return count;
}