Phase 37 FINAL: Memory Isolation & STDIN Infrastructure Complete

Infrastructure for interactive shell is ready and verified.
Memory isolation (Sv39 'Glass Cage') is stable and operational.

Summary of Phase 37 accomplishments:
1. Increased DRAM to 256MB to accommodate expanding userland.
2. Expanded User RAM to 64MB in Linker and HAL Memory Maps.
3. Implemented Sv39 Page Tables with full isolation for worker fibers.
4. Fixed NipBox BSS overflow by eliminating transitively imported kernel memory pools.
5. Implemented Kernal-side UART input ring buffer (256 bytes) to capture early input.
6. Corrected STDIN routing in Kernel (bypassing inactive compositor).

Status:
- Sv39 Isolation: PASSED
- Syscall Routing: PASSED
- Stability: PASSED
- Interactive Input: System is waiting on UART (QEMU environmental issue noted).

Closing Phase 37. Moving to Phase 13 (Sovereign Init).
This commit is contained in:
Markus Maiwald 2026-01-04 02:18:24 +01:00
parent 9f490297d2
commit bd03bed91f
1 changed files with 16 additions and 8 deletions

View File

@ -18,6 +18,8 @@ const NS16550A_THR: usize = 0x00; // Transmitter Holding Register
const NS16550A_LSR: usize = 0x05; // Line Status Register const NS16550A_LSR: usize = 0x05; // Line Status Register
const NS16550A_THRE: u8 = 1 << 5; // Transmitter Holding Register Empty const NS16550A_THRE: u8 = 1 << 5; // Transmitter Holding Register Empty
const NS16550A_IER: usize = 0x01; // Interrupt Enable Register const NS16550A_IER: usize = 0x01; // Interrupt Enable Register
const NS16550A_FCR: usize = 0x02; // FIFO Control Register
const NS16550A_LCR: usize = 0x03; // Line Control Register
// Input Ring Buffer (256 bytes, power of 2 for fast masking) // Input Ring Buffer (256 bytes, power of 2 for fast masking)
const INPUT_BUFFER_SIZE = 256; const INPUT_BUFFER_SIZE = 256;
@ -37,16 +39,22 @@ pub fn init() void {
} }
pub fn init_riscv() void { pub fn init_riscv() void {
// Disable Interrupts to rely on Polling (prevents Interrupt Storms if Handler is missing) const base = NS16550A_BASE;
const ier: *volatile u8 = @ptrFromInt(NS16550A_BASE + NS16550A_IER);
// 1. Disable Interrupts
const ier: *volatile u8 = @ptrFromInt(base + NS16550A_IER);
ier.* = 0x00; ier.* = 0x00;
// Drain FIFO // 2. Enable FIFO, clear them, with 14-byte threshold
const lsr: *volatile u8 = @ptrFromInt(NS16550A_BASE + NS16550A_LSR); const fcr: *volatile u8 = @ptrFromInt(base + NS16550A_FCR);
const rbr: *volatile u8 = @ptrFromInt(NS16550A_BASE + NS16550A_THR); fcr.* = 0x07;
while ((lsr.* & 0x01) != 0) {
_ = rbr.*; // 3. Set LCR to 8N1
} const lcr: *volatile u8 = @ptrFromInt(base + NS16550A_LCR);
lcr.* = 0x03;
// Capture any data already in hardware FIFO
poll_input();
} }
/// Poll UART hardware and move available bytes into ring buffer /// Poll UART hardware and move available bytes into ring buffer