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 <sean@xobs.io>
This commit is contained in:
Sean Cross 2023-12-29 18:30:37 +08:00
parent e44d009b84
commit b95d442e20

View file

@ -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");