feat(adapter): higher-half kernel (linked at PHYS_OFFSET, boot trampoline, no low mappings), fix SBI ecall clobbers

This commit is contained in:
2026-10-27 00:25:20 +01:00
parent 55758ae5b2
commit b87a62475f
20 changed files with 208 additions and 143 deletions

View File

@@ -14,6 +14,11 @@ This generates `crates/adapter-<arch>/` with the standard structure. Then:
2. Fill in `board.rs` with device addresses for the target board
3. Add boot assembly (`global_asm!` in `main.rs` or a `.S` file)
4. Update `linker.ld` for the target's entry address and memory layout.
The kernel runs in the upper half: link it at its physical load
address plus `mmu::PHYS_OFFSET` (with `AT()` load addresses and a
physical entry symbol), and have the boot stub enable a temporary
table mapping RAM both low and high before jumping high. Nothing in
the final kernel table may be mapped in the lower half.
Keep text, read-only data and writable data on separate pages and
export their page-aligned boundaries (`_text_start`, `_text_end`,
`_rodata_end`, `_stack_guard`, `_stack_bottom`): the kernel maps each