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.

History
29 lines·692 B·NASM Raw Blame
1; boot.asm — Kestrel stage 0.
2;
3; The BIOS loads this sector at 0x7C00 and jumps to it in 16-bit real mode.
4; We set up flat segments and a stack, enable A20, and halt.
5;
6; nasm -f bin boot.asm -o boot.bin
7; qemu-system-x86_64 -drive format=raw,file=boot.bin
8
9 bits 16
10 org 0x7C00
12start:
13 cli
14 xor ax, ax
15 mov ds, ax
16 mov es, ax
17 mov ss, ax
18 mov sp, 0x7C00
19 cld
21 in al, 0x92 ; fast A20 gate
22 or al, 2
23 out 0x92, al
25.halt: hlt
26 jmp .halt
28 times 510 - ($ - $$) db 0
29 dw 0xAA55 ; boot signature