aboutsummaryrefslogtreecommitdiff
path: root/CLAUDE.md
diff options
context:
space:
mode:
authorNatasha Moongrave <natasha@256phi.eu>2026-04-08 16:40:09 +0200
committerNatasha Moongrave <natasha@256phi.eu>2026-04-08 16:40:09 +0200
commitaf1089a4262414b64714b87180f2223c8a40918f (patch)
treeb208cdb34d0c4b43c5acff98127a824b4289e26a /CLAUDE.md
parenteb61ec76367731579eb585f39b251da629beb871 (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 'CLAUDE.md')
-rw-r--r--CLAUDE.md15
1 files changed, 10 insertions, 5 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
index d931abe..6a5aa38 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## Project Overview
-**Strix OS** is a bare-metal x86-64 operating system kernel written in Rust, aiming for Linux application compatibility. Currently in Phase 0-1 (foundational infrastructure).
+**Strix OS** is a bare-metal x86-64 operating system kernel written in Rust, aiming for Linux application compatibility. Currently in Phase 1 (memory management complete, heading into user space).
## Build Commands
@@ -45,13 +45,18 @@ cargo clean
| `gdt.rs` | Global Descriptor Table + Task State Segment (double-fault stack) |
| `interrupts.rs` | IDT setup, exception handlers, hardware interrupts (timer/keyboard via PIC 8259) |
| `memory.rs` | Page table access (`OffsetPageTable`), `BootInfoFrameAllocator` for physical frames |
+| `allocator.rs` | Heap allocator dispatcher; `HEAP_START`/`HEAP_SIZE` constants; `init_heap()` |
+| `allocator/bump.rs` | Simple bump allocator (fast alloc, dealloc only when all freed) |
+| `allocator/linked_list.rs` | First-fit linked-list allocator (arbitrary alloc/dealloc) |
+| `allocator/fixed_size_block.rs` | **Active**: hybrid fixed-size block allocator with 9 size classes (8–2048 bytes) + linked-list fallback |
| `vga_buffer.rs` | VGA text mode (80x25), `print!`/`println!` macros |
| `serial.rs` | UART 16550 serial output, `serial_print!`/`serial_println!` for debugging |
### Memory Model
-- Uses bootloader's `map_physical_memory` feature: all physical memory mapped at a fixed offset
+- Uses bootloader's `map_physical_memory` feature: all physical memory mapped at a fixed offset (`0x0000256000000000`)
- `OffsetPageTable` translates virtual ↔ physical addresses
- `BootInfoFrameAllocator` provides frames from bootloader's memory map
+- Heap region: virtual address `0x4444_4444_0000`, size 100 KiB
### Test Framework
- Custom `#[test_case]` attribute with `Testable` trait
@@ -74,7 +79,7 @@ cargo clean
## Roadmap
-See `roadmap.md` for the 6-phase development plan. Next priorities:
-1. Heap allocator (GlobalAlloc implementation)
-2. User space (Ring 3 transition, syscall interface)
+See `roadmap.md` for the 6-phase development plan. Phase 1 (memory management) is complete. Next priorities:
+1. User space (Ring 3 transition, syscall interface via SYSCALL/SYSRET MSRs)
+2. ELF loading (parser + execve)
3. Process management (fork, exec, scheduler)