summaryrefslogtreecommitdiffstats
path: root/rsdos/src
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-08-02 02:16:40 +0200
committersalmonik <salmonik@tuta.io>2026-08-02 02:16:40 +0200
commitd9fe082ef07b6e5c599585d6911dbad2bbe4c787 (patch)
treef54e2ff928bd23926858aba9bd44c7a6f82bb80b /rsdos/src
parentv0.5.5: self-diagnosing boot — vt refuses 0x0 geometry, panic band shows la... (diff)
downloadrs-dos-d9fe082ef07b6e5c599585d6911dbad2bbe4c787.tar.gz
rs-dos-d9fe082ef07b6e5c599585d6911dbad2bbe4c787.zip
v0.5.5: fix real-hardware boot crash — shadow back in heap as first allocation
User's machine: boot reached 'rsnix: boot done — shell' then panicked 'len is 0, index 0' at the first cell write — CELLS (the vt grid) was valid at vt::init and empty at the first shell paint, i.e. something stomped the heap between vt::init and the shell banner. The only change in that window vs the working v0.5.3 was the v0.5.4 move of the 1.9 MB display shadow from the heap to the fb-aware page allocator: on this machine's memory layout the page-allocator shadow's fill loop (480K words) clobbered the heap's vt vectors. - Shadow is again the *first* heap allocation, in gop::init before vt::init builds its grids (the v0.5.3 layout that provably boots on the user's hardware) — nothing else in the heap can collide with it. - init_heap now splits the free list at the GOP framebuffer hole instead of subtracting its size from one block that still *spanned* the hole — no heap allocation of any size can land on the display. - Kept the panic-proof try_reserve + fb-overlap rejection + no-shadow warning band; dropped the late init_shadow() call in main.rs. - Verified on QEMU: shadow @ 0x1980020 origin=heap, allocated before vt::init, fb clean at 0x80000000; all 5 suites PASS; 0 warnings.
Diffstat (limited to '')
-rw-r--r--rsdos/src/main.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/rsdos/src/main.rs b/rsdos/src/main.rs
index aa116e4..2717dff 100644
--- a/rsdos/src/main.rs
+++ b/rsdos/src/main.rs
@@ -162,7 +162,13 @@ pub unsafe extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut
162 let (rows, cols) = rsnix::vt::size(); 162 let (rows, cols) = rsnix::vt::size();
163 rsnix::serial_println!("vt: terminal ready ({}x{})", rows, cols); 163 rsnix::serial_println!("vt: terminal ready ({}x{})", rows, cols);
164 let (fw, fh) = rsnix::gop::pixel_dims(); 164 let (fw, fh) = rsnix::gop::pixel_dims();
165 rsnix::gop::boot_marker(&alloc::format!("rsnix: gop {}x{} vt {}x{} ok", fw, fh, cols, rows)); 165 rsnix::gop::boot_marker(&alloc::format!(
166 "rsnix: gop {}x{} vt {}x{} ok",
167 fw,
168 fh,
169 cols,
170 rows
171 ));
166 172
167 // ExitBootServices — we now own the machine 173 // ExitBootServices — we now own the machine
168 if unsafe { (bs.exit_boot_services)(image_handle, map_key) } != EFI_SUCCESS { 174 if unsafe { (bs.exit_boot_services)(image_handle, map_key) } != EFI_SUCCESS {
@@ -212,7 +218,6 @@ pub unsafe extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut
212 } else { 218 } else {
213 rsnix::serial_println!("pages: init FAILED"); 219 rsnix::serial_println!("pages: init FAILED");
214 } 220 }
215 rsnix::gop::init_shadow();
216 rsnix::gop::boot_marker("rsnix: shadow ok"); 221 rsnix::gop::boot_marker("rsnix: shadow ok");
217 if rsnix::memory::page_self_test() { 222 if rsnix::memory::page_self_test() {
218 rsnix::serial_println!("pages: self-test OK (alloc/free/runs)"); 223 rsnix::serial_println!("pages: self-test OK (alloc/free/runs)");