summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/src/lib.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/shell/src/lib.rs b/shell/src/lib.rs
index b2c4a1b..a32d259 100644
--- a/shell/src/lib.rs
+++ b/shell/src/lib.rs
@@ -41,6 +41,24 @@ pub fn run() -> ! {
41 env!("CARGO_PKG_VERSION") 41 env!("CARGO_PKG_VERSION")
42 )); 42 ));
43 43
44 // A crash report from a previous run survives on the disk (the fault
45 // handler writes crash.log on the mounted volume before halting; real
46 // hardware has no serial console). Surface it so the user can report it.
47 if let Some(h) = rsnix::fs::read_crash_log() {
48 term_println("!!! PREVIOUS CRASH REPORT:");
49 let mut buf = [0u8; 256];
50 if let Ok(n) = rsnix::fs::read(h, &mut buf, 0)
51 && n > 0 {
52 let s = core::str::from_utf8(&buf[..n]).unwrap_or("?");
53 for line in s.split('\n') {
54 if !line.is_empty() {
55 term_println(line);
56 }
57 }
58 }
59 term_println("!!! end of crash report");
60 }
61
44 loop { 62 loop {
45 // Push any deferred scrolls so the prompt renders on a current 63 // Push any deferred scrolls so the prompt renders on a current
46 // framebuffer (e.g. after a streaming command's batch of output). 64 // framebuffer (e.g. after a streaming command's batch of output).
@@ -722,6 +740,7 @@ write `{} <path> TIL <marker>`",
722 "kill" => cmd_kill(&parsed), 740 "kill" => cmd_kill(&parsed),
723 "demo" => cmd_demo(&parsed), 741 "demo" => cmd_demo(&parsed),
724 "fault" => cmd_fault(), 742 "fault" => cmd_fault(),
743 "crashlog" => cmd_crashlog(),
725 "stall" => cmd_stall(&parsed), 744 "stall" => cmd_stall(&parsed),
726 _ => term_err(&alloc::format!("unknown command: {}", cmd)), 745 _ => term_err(&alloc::format!("unknown command: {}", cmd)),
727 } 746 }
@@ -820,6 +839,14 @@ fn cmd_fault() {
820 } 839 }
821} 840}
822 841
842/// Debug hook: run the crash-log FAT write from the *shell* context (not
843/// the fault ISR) to compare behaviour.
844fn cmd_crashlog() {
845 let lines = ["!!! test crashlog write", "second line", "third line"];
846 rsnix::fs::write_crash_log(&lines);
847 term_println("crashlog: done");
848}
849
823/// Set the display-store stall (cycles per word) — diagnostics knob that 850/// Set the display-store stall (cycles per word) — diagnostics knob that
824/// simulates the per-write cost of an uncached real-GPU framebuffer so 851/// simulates the per-write cost of an uncached real-GPU framebuffer so
825/// the preemptive scheduler races long scroll pushes like on real 852/// the preemptive scheduler races long scroll pushes like on real