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.

1 branch · 1 tag History
README.md

kestrel

A small x86-64 kernel, built one boot stage at a time. Stage 0 fits in the boot sector and goes from real mode straight to long mode.

make run

QEMU shows kestrel in amber, in the middle of the screen, written by 64-bit code.

Stage 0, in order

  1. Zero the segment registers and put the stack under the boot sector.
  2. Open the A20 gate through port 0x92, keeping bit 0 clear (it resets the machine).
  3. Build PML4 → PDPT → PD at 0x1000–0x3FFF, mapping the first 2 MiB with one huge page.
  4. Set CR4.PAE, load CR3, set EFER.LME, then turn on CR0.PG and CR0.PE together.
  5. Far-jump into the 64-bit code segment and write the banner to 0xB8000.

Skipping protected mode works on QEMU. Real-hardware reports belong in the issues.