diff options
| author | Natasha Moongrave <natasha@256phi.eu> | 2026-04-08 16:40:09 +0200 |
|---|---|---|
| committer | Natasha Moongrave <natasha@256phi.eu> | 2026-04-08 16:40:09 +0200 |
| commit | af1089a4262414b64714b87180f2223c8a40918f (patch) | |
| tree | b208cdb34d0c4b43c5acff98127a824b4289e26a /NOTES.md | |
| parent | eb61ec76367731579eb585f39b251da629beb871 (diff) | |
[Phase 2.1] GDT user space segments + heap growth
- Restructure GDT to add kernel_data/user_data/user_code in the order
required for SYSCALL/SYSRET ABI:
0x08 kernel code, 0x10 kernel data, 0x18 user data, 0x20 user code, 0x28 TSS
STAR MSR values: STAR[47:32]=0x08, STAR[63:48]=0x10
- Add TSS.privilege_stack_table[0] (RSP0) with 8 KiB static initial stack
for Ring3→Ring0 hardware interrupt transitions
- Expose GDT static and all Selectors fields as pub (needed by syscall module)
- Add set_kernel_stack(VirtAddr) for scheduler to update RSP0 per-process
- Grow HEAP_SIZE 100 KiB → 4 MiB to support process table + kernel stacks
- Fix pre-existing lifetime elision lint in allocator.rs
- Update flake.nix: add cpio, busybox, gdb, binutils, e2fsprogs
- Update NOTES.md with decisions and next steps
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'NOTES.md')
| -rw-r--r-- | NOTES.md | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -17,9 +17,9 @@ ## Current Status **Branch**: `CLAUDE_TEST` -**Phase**: Starting Phase 2 — User Space Foundation -**Last commit**: `[Step 0] Add PLAN.md and NOTES.md` -**Next task**: `[Phase 2.1]` — Extend GDT with user space segments +**Phase**: Phase 2 — User Space Foundation +**Last commit**: `[Phase 2.1] GDT user space segments + heap growth` +**Next task**: `[Phase 2.2]` — SYSCALL/SYSRET MSR setup --- @@ -75,4 +75,20 @@ User address limit: 0x0000_8000_0000_0000 (canonical boundary) **Next**: Phase 2.1 — Extend GDT. **Decisions**: None new. +### [Phase 2.1] 2026-04-08 — GDT user space segments + heap growth +**Done**: +- Restructured `StrixKernel/src/gdt.rs`: added `kernel_data`, `user_data`, `user_code` segments in the correct order for SYSCALL/SYSRET ABI +- Added `TSS.privilege_stack_table[0]` (RSP0) with an 8 KiB static initial stack +- Exposed `GDT` static and `Selectors` fields as `pub` for use by syscall setup +- Added `set_kernel_stack(VirtAddr)` for the scheduler to update RSP0 per-process +- Grew `HEAP_SIZE` from 100 KiB → 4 MiB in `allocator.rs` (needed for process table) +- Fixed pre-existing lifetime lint in `allocator.rs` +- Updated `flake.nix` to add `cpio`, `busybox`, `gdb`, `binutils`, `e2fsprogs` +- `basic_boot` integration test passes in QEMU via `nix develop` +**Next**: Phase 2.2 — SYSCALL/SYSRET MSR setup (`src/syscall/mod.rs`) +**Decisions**: +- GDT order: kernel_code(0x08) / kernel_data(0x10) / user_data(0x18) / user_code(0x20) / TSS(0x28) +- STAR MSR: `[47:32]=0x08`, `[63:48]=0x10` → SYSRET CS=0x20, SS=0x18 +- `set_kernel_stack` uses raw pointer write inside `unsafe {}` block; safe when interrupts disabled + --- |
