aboutsummaryrefslogtreecommitdiff
path: root/NOTES.md
diff options
context:
space:
mode:
Diffstat (limited to 'NOTES.md')
-rw-r--r--NOTES.md35
1 files changed, 32 insertions, 3 deletions
diff --git a/NOTES.md b/NOTES.md
index 3463729..ef4f707 100644
--- a/NOTES.md
+++ b/NOTES.md
@@ -5,6 +5,19 @@
---
+## Environment
+
+All `cargo run`, `cargo test`, and QEMU commands **must** be run inside the Nix
+development environment. From the repo root:
+
+```
+nix develop
+cd StrixKernel
+cargo test # or cargo run
+```
+
+---
+
## How to Resume After Context Reset
1. Read this file top-to-bottom
@@ -17,9 +30,9 @@
## Current Status
**Branch**: `CLAUDE_TEST`
-**Phase**: Phase 2 — User Space Foundation
-**Last commit**: `[Phase 2.2/2.3] SYSCALL/SYSRET MSR setup + syscall dispatcher`
-**Next task**: `[Phase 2.4]` — Process structure (task/process.rs)
+**Phase**: Phase 3 implementation done, awaiting test run + commit
+**Last commit**: `[Phase 2.4-2.6] Process structure, scheduler, Ring 3 spawn`
+**Next task**: Run `cargo test` in `nix develop`, then commit Phase 3.1–3.5; then write integration tests
---
@@ -89,6 +102,22 @@ User address limit: 0x0000_8000_0000_0000 (canonical boundary)
- `sys_write` uses raw pointer + `read_volatile` loop (not `&[u8]` slice) on user memory
- `sys_exit` currently halts; Phase 2.5 will add proper process termination
+### [Phase 3.1-3.5] 2026-04-08 — ELF loader, address spaces, execve, initramfs
+**Done**:
+- `src/loader/elf.rs`: ELF64 parser via goblin; validates magic/class/type; W^X + bounds enforcement; iterator over PT_LOAD segments; interpreter detection
+- `src/loader/stack.rs`: SysV AMD64 initial user stack builder (argc/argv/envp/auxv)
+- `src/memory/address_space.rs`: per-process PML4; copies kernel high-half; `alloc_and_map`, `map_range`, `switch` (CR3 write), `write_bytes`
+- `src/memory/mod.rs` → `src/memory/` directory module; added `PHYS_MEM_OFFSET` AtomicU64 set by `init()`
+- `src/initramfs.rs`: newc CPIO parser; `lookup(path)` → `Option<&'static [u8]>`; INITRAMFS static (empty until build.rs is added)
+- `src/syscall/exec.rs`: `sys_execve` (#59); loads from initramfs, builds address space, sets up stack, switches CR3, jumps to Ring 3
+- Added goblin (`elf32+elf64+endian_fd`) and bitflags to Cargo.toml
+- Build is clean (zero warnings)
+**Next**: Run `cargo test` in `nix develop`; write Phase 3 integration tests; add `build.rs` + initramfs content
+**Decisions**:
+- goblin needs `elf32+elf64+endian_fd` features together for the combined `Elf` struct (elf64-only is gated behind elf32 too)
+- `PHYS_MEM_OFFSET` stored as AtomicU64 in `memory/mod.rs` so submodules can access it without threading VirtAddr through every call
+- `INITRAMFS` is an empty static for now; build.rs + cpio generation deferred to Phase 3.5 follow-up
+
### [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