[chore] Create AGENTS.md

This commit is contained in:
2026-05-24 19:52:01 +08:00
Unverified
parent 2c17e426c1
commit 990c2a6295
+33
View File
@@ -0,0 +1,33 @@
# Sylva OS — Agent Guide
x86_64 UEFI hobby OS kernel. C17 boot → C++17 kernel, ELF64 → PE32+ via objcopy.
## Build & Run
| Command | What |
|---------|------|
| `make` | Build `build/BOOTX64.EFI` |
| `make run` | QEMU + OVMF, serial → `serial.log`, paused for GDB (`-s -S`) |
| `make clean` | **Always before commit** — gnu-efi produces untracked files |
## Architecture
- `boot.c` — UEFI entrypoint (`efi_main`), calls `kernel_main()`
- `kernel/main.cpp``extern "C" kernel_main()`: init GOP → serial → PMM → heap → idle loop (`hlt`)
- `kernel/serial.cpp` — UEFI serial protocol wrapper
- `kernel/memory/pmm.cpp` — bitmap + free-list physical page allocator
- `kernel/memory/heap.cpp` — kmalloc/kfree/kcalloc/krealloc (first-fit, coalescing)
- `graphics/` — GOP framebuffer pixel drawing
- `fonts/` — Hankaku 8×16 pixel font renderer
- `gnu-efi/` — git submodule (https://github.com/ncroxon/gnu-efi.git)
## Quirks
- **`uefi_call_wrapper` required for all UEFI protocol calls or kernel page-faults**
- `kernel_main` must be `extern "C"` (C→C++ linkage)
- QEMU starts paused — connect GDB to :1234 to proceed
- No tests, no CI, no lint/formatter config
- C17 (`boot.c`), C++17 (`kernel/`)
- Standards: `-ffreestanding -fno-stack-protector -fshort-wchar -mno-red-zone`
- `#define ASM asm volatile` in `include/common.h`
- `BUILD_INFOS.h` is a placeholder for CI