summaryrefslogtreecommitdiffstats
path: root/rsdos/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--rsdos/src/main.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/rsdos/src/main.rs b/rsdos/src/main.rs
index 3153930..b6393ee 100644
--- a/rsdos/src/main.rs
+++ b/rsdos/src/main.rs
@@ -45,6 +45,31 @@ fn panic(info: &PanicInfo) -> ! {
45 loc.line() 45 loc.line()
46 ); 46 );
47 } 47 }
48 // Real hardware has no serial console — put the panic on the screen
49 // too (white-on-red band), so a pre-shell panic is not a silent
50 // blank screen.
51 let mut loc_buf = [0u8; 96];
52 let mut msg_buf = [0u8; 128];
53 let loc_n = {
54 let mut w = rsnix::strbuf::FmtBuf::new(&mut loc_buf);
55 if let Some(loc) = info.location() {
56 let _ = write!(&mut w, "at {}:{}", loc.file(), loc.line());
57 } else {
58 let _ = write!(&mut w, "(no location)");
59 }
60 w.len()
61 };
62 let msg_n = {
63 let mut w = rsnix::strbuf::FmtBuf::new(&mut msg_buf);
64 let _ = write!(&mut w, "{}", info.message());
65 w.len()
66 };
67 let lines = [
68 "*** PANIC ***",
69 core::str::from_utf8(&msg_buf[..msg_n]).unwrap_or("?"),
70 core::str::from_utf8(&loc_buf[..loc_n]).unwrap_or("?"),
71 ];
72 rsnix::gop::dump_lines(&lines);
48 loop { 73 loop {
49 unsafe { 74 unsafe {
50 core::arch::asm!("cli; hlt"); 75 core::arch::asm!("cli; hlt");
@@ -121,9 +146,11 @@ pub unsafe extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut
121 } else { 146 } else {
122 rsnix::serial_println!("gop: not found (0x{:x})", gop_result); 147 rsnix::serial_println!("gop: not found (0x{:x})", gop_result);
123 } 148 }
149 rsnix::gop::boot_marker("rsnix v0.5.5 booting..");
124 rsnix::vt::init(); 150 rsnix::vt::init();
125 let (rows, cols) = rsnix::vt::size(); 151 let (rows, cols) = rsnix::vt::size();
126 rsnix::serial_println!("vt: terminal ready ({}x{})", rows, cols); 152 rsnix::serial_println!("vt: terminal ready ({}x{})", rows, cols);
153 rsnix::gop::boot_marker("rsnix: gop+vt ok");
127 154
128 // ExitBootServices — we now own the machine 155 // ExitBootServices — we now own the machine
129 if unsafe { (bs.exit_boot_services)(image_handle, map_key) } != EFI_SUCCESS { 156 if unsafe { (bs.exit_boot_services)(image_handle, map_key) } != EFI_SUCCESS {
@@ -158,6 +185,7 @@ pub unsafe extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut
158 } 185 }
159 rsnix::interrupts::init(); 186 rsnix::interrupts::init();
160 rsnix::serial_println!("intr: IDT loaded, PIC remapped, timer ~100 Hz"); 187 rsnix::serial_println!("intr: IDT loaded, PIC remapped, timer ~100 Hz");
188 rsnix::gop::boot_marker("rsnix: serial+ps2+gdt+intr ok");
161 189
162 dump_memory_summary(); 190 dump_memory_summary();
163 191
@@ -173,6 +201,7 @@ pub unsafe extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut
173 rsnix::serial_println!("pages: init FAILED"); 201 rsnix::serial_println!("pages: init FAILED");
174 } 202 }
175 rsnix::gop::init_shadow(); 203 rsnix::gop::init_shadow();
204 rsnix::gop::boot_marker("rsnix: shadow ok");
176 if rsnix::memory::page_self_test() { 205 if rsnix::memory::page_self_test() {
177 rsnix::serial_println!("pages: self-test OK (alloc/free/runs)"); 206 rsnix::serial_println!("pages: self-test OK (alloc/free/runs)");
178 } else { 207 } else {
@@ -228,6 +257,7 @@ pub unsafe extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut
228 } 257 }
229 258
230 rsnix::serial_println!("boot: entering shell"); 259 rsnix::serial_println!("boot: entering shell");
260 rsnix::gop::boot_marker("rsnix: boot done — shell");
231 if rsnix::ps2::mouse_present() { 261 if rsnix::ps2::mouse_present() {
232 rsnix::cursor::spawn(); 262 rsnix::cursor::spawn();
233 } else { 263 } else {