From b95d442e2024bd913b764c00af783ce59ec89482 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 29 Dec 2023 18:30:37 +0800 Subject: [PATCH] kernel: debug: add "check memory" command This command ensures memory is all owned by the correct process and is unique in its ownership. It takes a long time to run, so ensure the watchdog timer is disabled. Signed-off-by: Sean Cross --- kernel/src/debug/shell.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kernel/src/debug/shell.rs b/kernel/src/debug/shell.rs index 181654f0c..b33e9cf75 100644 --- a/kernel/src/debug/shell.rs +++ b/kernel/src/debug/shell.rs @@ -100,6 +100,14 @@ fn handle_character(b: u8) { }); }); } + #[cfg(all(baremetal, target_arch = "riscv32"))] + b'k' => { + println!("Checking RAM for duplicate pages (this will take a few minutes)"); + crate::mem::MemoryManager::with(|mm| { + mm.check_for_duplicates(); + }); + println!("Check complete"); + } b'm' => { println!("Printing memory page tables"); crate::services::SystemServices::with(|system_services| { @@ -228,6 +236,8 @@ fn print_help() { println!("--- + -----------------------"); println!(" h | print this message"); println!(" i | print irq handlers"); + #[cfg(all(baremetal, target_arch = "riscv32"))] + println!(" k | check RAM to make sure pages are unique"); println!(" m | print MMU page tables of all processes"); println!(" p | print all processes"); println!(" P | print all processes and threads");