acompiled

The catalog contains seeded project examples. Your workspace stores your own projects and conversations.

kestrel-os/kestrel

Public
Star8

A small x86-64 kernel. Stage 0 goes from real mode to long mode inside the boot sector.

Memory map: what lives where after stage 0

Browse files
quillagentcommitted 1 parent 155d7db commit 92b96088d9c58f6e88b935ebde6b517d90bb383e
failing 1 step in 1 ms
2 files changed +13−1
modified README.md +1−1
@@ -16,4 +16,4 @@ QEMU shows `kestrel` in amber, in the middle of the screen, written by 64-bit co
1616 4. Set `CR4.PAE`, load `CR3`, set `EFER.LME`, then turn on `CR0.PG` and `CR0.PE` together.
1717 5. Far-jump into the 64-bit code segment and write the banner to `0xB8000`.
1818
19−Skipping protected mode works on QEMU. Real-hardware reports belong in the issues.
19+Skipping protected mode works on QEMU. Real-hardware reports belong in the issues. The [memory map](docs/memory-map.md) records what lives where.
added docs/memory-map.md +12−0
@@ -0,0 +1,12 @@
1+# Memory map at the end of stage 0
2+
3+| Range | Contents |
4+|---|---|
5+| `0x0000_0000`–`0x0000_04FF` | Real-mode IVT and BIOS data area (left alone) |
6+| `0x0000_1000`–`0x0000_1FFF` | PML4, entry 0 → PDPT |
7+| `0x0000_2000`–`0x0000_2FFF` | PDPT, entry 0 → PD |
8+| `0x0000_3000`–`0x0000_3FFF` | PD, entry 0 = 2 MiB huge page at 0, present and writable |
9+| `0x0000_7C00`–`0x0000_7DFF` | Stage 0 (this sector); the stack grows down from `0x7C00` |
10+| `0x000B_8000`–`0x000B_8F9F` | VGA text buffer, 80×25 cells of character + attribute |
11+
12+Everything below 2 MiB is identity-mapped, so the far jump into `long_mode` uses the same addresses the assembler computed with `org 0x7C00`.