mirror of
https://github.com/gbowne1/ClassicOS.git
synced 2026-02-11 13:25:19 -08:00
- 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
19 lines
582 B
C
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;
|
|
}
|