| Filename | Latest commit message | Latest commit date |
|---|---|---|
Every page table SchOS built -- the loader's, which the kernel starts on and the other CPUs start through, and the kernel's own direct map and device window -- mapped memory in 1 GB pages. Intel's desktop CPUs before Haswell do not have them, and there the PS bit in a PDPT entry is reserved: the first access after the switch is a page fault that cannot be handled either. An HP all-in-one with an Ivy Bridge i3 showed "Placing and starting the kernel" and reset. Both now check CPUID 0x80000001 EDX bit 26. Without it the loader maps the low 4 GB through four page directories of 2 MB pages, placed below the kernel where nothing reuses them, and keeps the staged kernel segments below 4 GB; the kernel gives each gigabyte of its direct map and of ioremap() a page directory of its own. Neither KVM nor QEMU's emulator enforces the reserved bit, so the fault itself could not be reproduced here. With the fallback forced on, the kernel boots at 2 and 8 GB, both CPUs start, and evtest passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4 |
||
| .. | ||
| efi.h | ||
| main.c | ||
| README.md | ||
| startup.nsh | ||
UEFI loader
The loader. This directory once existed only so the BIOS path could be moved
into boot/bios/ without pretending the split was hypothetical; it is now the
only path there is.
See ../README.md for the hand-off contract a loader has to satisfy. The
short version: the kernel wants long mode with paging on, its ELF segments
placed, a 24-byte-entry E820-shaped memory map, and framebuffer geometry — and
it does not care which firmware produced them.
What this will need, in rough order:
- A PE/COFF target. clang can emit one directly
(
--target=x86_64-unknown-windows -fuse-ld=lld-link), so no new toolchain: the same LLVM install already builds every other target here. - The handful of UEFI structures actually used — the system table, boot
services,
LOADED_IMAGE,SIMPLE_FILE_SYSTEM,GRAPHICS_OUTPUT. Written from the specification rather than by importing gnu-efi or EDK II, which is both a licence question and a large dependency for something this small. GetMemoryMaptranslated into the same 24-byte entriese820.calready parses. Not a second format for the kernel to learn.ExitBootServicesbefore touching the memory it described.- Graphics Output Protocol for the framebuffer, filling the same
VBE_INFO_ADDRstructure the kernel reads.
The image goes at EFI/BOOT/BOOTX64.EFI on a FAT ESP, which also means the
ISO carries a single El Torito EFI entry.