summaryrefslogtreecommitdiffstats
path: root/rsnix/src/sched.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-08-01 18:25:55 +0200
committersalmonik <salmonik@tuta.io>2026-08-01 18:25:55 +0200
commit1ea2f68e6a9af135e6cb3274fdf28d4ddc5812d5 (patch)
treef28246586e387293d0c8beaf6b445210aaab8c48 /rsnix/src/sched.rs
parentklog/tty/pager: no more truncated lines — full lines flow, terminal wraps (diff)
downloadrs-dos-1ea2f68e6a9af135e6cb3274fdf28d4ddc5812d5.tar.gz
rs-dos-1ea2f68e6a9af135e6cb3274fdf28d4ddc5812d5.zip
fix pi-lens warnings: unwraps, shell SC2046, dup code (fmtbuf/scripts/hexdump/cat/ahci/pci)
- memory.rs: self-test Layout::from_size_align no longer panics — the test fails cleanly on an invalid layout - fat.rs: v() no longer unwraps the active-volume slot — invariant violation logs + halts instead of panicking mid-disk-io - strbuf: shared FmtBuf replaces the duplicated PanicBuf/FmtBuf (main.rs + sched.rs) - test-disk.sh: SC2046 — conditional --fresh arg no longer relies on word splitting - scripts: boot.sh/boot-image.sh share lib-boot-args.sh (dup args loop) - shell: cat/hexdump stdin pairs unified with Option<&str> marker; hexdump format_row folded into format_partial - ahci: read/write_sectors unified behind dma_sectors - pci: config_read/write share config_addr
Diffstat (limited to 'rsnix/src/sched.rs')
-rw-r--r--rsnix/src/sched.rs18
1 files changed, 2 insertions, 16 deletions
diff --git a/rsnix/src/sched.rs b/rsnix/src/sched.rs
index 4b10503..6ffa745 100644
--- a/rsnix/src/sched.rs
+++ b/rsnix/src/sched.rs
@@ -372,7 +372,7 @@ pub fn page_fault(cr2: u64, frame_ptr: usize) -> usize {
372 let rip = unsafe { (frame_ptr as *const IntFrame).read().rip }; 372 let rip = unsafe { (frame_ptr as *const IntFrame).read().rip };
373 let mut buf = [0u8; 96]; 373 let mut buf = [0u8; 96];
374 let n = { 374 let n = {
375 let mut f = FmtBuf { b: &mut buf, n: 0 }; 375 let mut f = crate::strbuf::FmtBuf::new(&mut buf);
376 let _ = fmt::write( 376 let _ = fmt::write(
377 &mut f, 377 &mut f,
378 core::format_args!( 378 core::format_args!(
@@ -386,7 +386,7 @@ pub fn page_fault(cr2: u64, frame_ptr: usize) -> usize {
386 rip 386 rip
387 ), 387 ),
388 ); 388 );
389 f.n 389 f.len()
390 }; 390 };
391 abort_current(core::str::from_utf8(&buf[..n]).unwrap_or("task fault")) 391 abort_current(core::str::from_utf8(&buf[..n]).unwrap_or("task fault"))
392} 392}
@@ -528,17 +528,3 @@ fn idle_main() {
528 } 528 }
529 } 529 }
530} 530}
531
532struct FmtBuf<'a> {
533 b: &'a mut [u8],
534 n: usize,
535}
536
537impl fmt::Write for FmtBuf<'_> {
538 fn write_str(&mut self, s: &str) -> fmt::Result {
539 let m = s.len().min(self.b.len() - self.n);
540 self.b[self.n..self.n + m].copy_from_slice(&s.as_bytes()[..m]);
541 self.n += m;
542 Ok(())
543 }
544}