# Physical memory layout ## Low memory | Type | Range | | |----------|---------------------|-------------------------------------------------| | Reserved | 0x000000 - 0x000400 | real-mode interrupt vector table | | Reserved | 0x000400 - 0x000500 | bios data area | | Usable | 0x000500 - 0x004000 | main stack | | Usable | 0x004000 - 0x006a00 | globals | | Usable | 0x006a00 - 0x007c00 | memory map | | Usable | 0x007c00 - 0x007e00 | boot sector | | Usable | 0x007e00 - 0x080000 | conventional usable memory | | Reserved | 0x080000 - 0x0a0000 | extended bios data area (maximum possible size) | | Reserved | 0x0a0000 - 0x0c0000 | video memory | | Reserved | 0x0c0000 - 0x0c8000 | video bios | | Reserved | 0x0c8000 - 0x0f0000 | bios expansions | | Reserved | 0x0f0000 - 0x100000 | motherboard bios | ### Allocations - 0x00500 - 0x04000: stage 1/2 stack - 0x04000 - 0x06a00: globals - 0x07c00 - 0x07e00: stage 1 text - 0x07e00 - 0x08000: gpt partition header - 0x08000 - 0x08200: stage 2 partition table entry - 0x08200 - 0x0c000: stage 2 text, stage 3 stack - 0x0e000 : gdt - 0x10000 : stage 3 text 0x10000: stage 3 TODO: once we're in real mode, repurpose s2 for a stack TODO: load s3 into a separate memory region TODO: use some fixed known memory address for the GDT, rather than putting it in stage 2. That way, we can safely overwrite stage 2 once we're done with it.