summaryrefslogtreecommitdiffstats
path: root/rsdos
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-08-01 22:28:34 +0200
committersalmonik <salmonik@tuta.io>2026-08-01 22:28:34 +0200
commitab7d87bcde31c1681ea09c30534dde840a58d6fa (patch)
tree42eed2c86663cf6ecfa3507ca46399e31b441c99 /rsdos
parentrsboot: track latest upstream HEAD (92367a8) instead of pinned ee1c85b (diff)
downloadrs-dos-ab7d87bcde31c1681ea09c30534dde840a58d6fa.tar.gz
rs-dos-ab7d87bcde31c1681ea09c30534dde840a58d6fa.zip
rsnix v0.5.2: fault diagnostics + real-hardware scroll-crash hardening
The real-hardware scroll crash (white bands + instant freeze, QEMU-clean) was invisible because the only trace was a single serial line on machines with no serial console. This makes every crash self-identifying and hardens the real-hardware failure surfaces: - Every CPU exception vector 0-31 now has an IDT entry (macro-generated stubs; 8/14 keep their IST stacks). A fault in the shell prints a white-on-red band to the framebuffer via gop::dump_lines (raw fb writes bypassing the vt, fully clamped) plus a parseable serial line: '!!! <kind> vec=N err=… rip=… cr2=… rsp=… rflags=… task=N "name"', then halts — instead of converging to a cryptic double fault. Background-task faults abort the task as before. - Boot log now reports the authoritative post-SetMode geometry: 'gop: fb base=… size=… pitch=… WxH bpp=… bgr=…', so the next real machine's report identifies whether pitch*height exceeds the mapping. - Framebuffer writes (clear, push_rect, shift_up_n bulk push, cursor overlay) are clamped to the firmware's framebuffer_size: a pitch- padded mode degrades to a truncated view instead of faulting past the mapping. - The GOP framebuffer region is excluded from the page allocator (and subtracted from the heap's conventional-region pick) even when the firmware lists it as ConventionalMemory — kernel allocations can never overwrite the display again. The GOP protocol is located and peeked before the memory map is captured so the exclusion is known at heap-init time. - Shell gains a hidden 'fault' command (deliberate unmapped write) and 'make test-fault' verifies the dump: vec=14, cr2=0x400000000000, task=0, halt — no triple fault. All other suites re-pass. - CONTEXT.md: fault-dump format documented for real-hardware reports.
Diffstat (limited to '')
-rw-r--r--rsdos/src/main.rs28
1 files changed, 18 insertions, 10 deletions
diff --git a/rsdos/src/main.rs b/rsdos/src/main.rs
index 13923ea..6dbad5f 100644
--- a/rsdos/src/main.rs
+++ b/rsdos/src/main.rs
@@ -87,16 +87,10 @@ pub unsafe extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut
87 rsnix::serial::init(); 87 rsnix::serial::init();
88 rsnix::serial_println!("=== rsnix boot ==="); 88 rsnix::serial_println!("=== rsnix boot ===");
89 89
90 // Stash the memory map 90 // Locate GOP (Graphics Output Protocol) *before* the memory map is
91 let map_key = match rsnix::memory::capture_memory_map(bs) { 91 // captured: the heap/page allocators need to know the framebuffer
92 Ok(k) => k, 92 // region so they never hand out its pages (some real firmware lists
93 Err(e) => { 93 // it as conventional memory).
94 rsnix::serial_println!("mem: capture_memory_map failed 0x{:x}", e);
95 0
96 }
97 };
98
99 // Locate GOP (Graphics Output Protocol)
100 let mut gop_interface: *mut core::ffi::c_void = core::ptr::null_mut(); 94 let mut gop_interface: *mut core::ffi::c_void = core::ptr::null_mut();
101 let gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; 95 let gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
102 let gop_result = unsafe { 96 let gop_result = unsafe {
@@ -108,6 +102,20 @@ pub unsafe extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut
108 }; 102 };
109 if gop_result == EFI_SUCCESS { 103 if gop_result == EFI_SUCCESS {
110 let gop = unsafe { &mut *(gop_interface as *mut GraphicsOutputProtocol) }; 104 let gop = unsafe { &mut *(gop_interface as *mut GraphicsOutputProtocol) };
105 rsnix::gop::peek_fb_region(gop);
106 }
107
108 // Stash the memory map
109 let map_key = match rsnix::memory::capture_memory_map(bs) {
110 Ok(k) => k,
111 Err(e) => {
112 rsnix::serial_println!("mem: capture_memory_map failed 0x{:x}", e);
113 0
114 }
115 };
116
117 if gop_result == EFI_SUCCESS {
118 let gop = unsafe { &mut *(gop_interface as *mut GraphicsOutputProtocol) };
111 rsnix::serial_println!("gop: framebuffer found"); 119 rsnix::serial_println!("gop: framebuffer found");
112 rsnix::gop::init(gop); 120 rsnix::gop::init(gop);
113 } else { 121 } else {