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
This commit is contained in:
vmttmv
2026-01-15 21:39:53 +02:00
parent f572101d6b
commit 4fa82854dd
6 changed files with 98 additions and 53 deletions

View File

@@ -11,16 +11,16 @@ Bootloader documentation for ClassicOS
## Stage 1 (`stage1.asm`)
Responsible for loading the second stage using BIOS routines, and switching to protected mode.
- Queries CHS parameters from BIOS
- Loads the second stage bootloader (2048 B) to `0x7c00`
- Sets up a GDT with descriptor entries for code and data both covering the whole 32-bit address space
- Enables A20
- Set CR0.PE (enable protected mode) and jump to stage 2
- Jumps to stage2
## Stage 2 (`stage2.asm, stage2_load.c`)
- Read and store E820 memory map from BIOS
- Sets up a GDT with descriptor entries for code and data both covering the whole 32-bit address space
- Set CR0.PE (enable protected mode)
- Set up segment registers
- Load the kernel ELF header
- Parse the program headers, and load all `PT_LOAD` segments from disk