mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
kernel: add debug command to print interrupts
This can be used to ensure the interrupt handlers are where we think they are. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
2962d4ffc3
commit
75116d36cd
2 changed files with 30 additions and 0 deletions
|
|
@ -167,6 +167,21 @@ fn process_irq_character(b: u8) {
|
||||||
}
|
}
|
||||||
|
|
||||||
match b {
|
match b {
|
||||||
|
b'i' => {
|
||||||
|
println!("Interrupt handlers:");
|
||||||
|
println!(" IRQ | Process | Handler | Argument");
|
||||||
|
crate::services::SystemServices::with(|system_services| {
|
||||||
|
crate::irq::for_each_irq(|irq, pid, address, arg| {
|
||||||
|
println!(
|
||||||
|
" {}: {} @ {:x?} {:x?}",
|
||||||
|
irq,
|
||||||
|
system_services.process_name(*pid).unwrap_or(""),
|
||||||
|
address,
|
||||||
|
arg
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
b'm' => {
|
b'm' => {
|
||||||
println!("Printing memory page tables");
|
println!("Printing memory page tables");
|
||||||
crate::services::SystemServices::with(|system_services| {
|
crate::services::SystemServices::with(|system_services| {
|
||||||
|
|
@ -268,6 +283,7 @@ fn process_irq_character(b: u8) {
|
||||||
println!("--- + -----------------------");
|
println!("--- + -----------------------");
|
||||||
#[cfg(all(feature = "gdbserver", baremetal))]
|
#[cfg(all(feature = "gdbserver", baremetal))]
|
||||||
println!(" g | enter the gdb server");
|
println!(" g | enter the gdb server");
|
||||||
|
println!(" i | print irq handlers");
|
||||||
println!(" m | print MMU page tables of all processes");
|
println!(" m | print MMU page tables of all processes");
|
||||||
println!(" p | print all processes");
|
println!(" p | print all processes");
|
||||||
println!(" P | print all processes and threads");
|
println!(" P | print all processes and threads");
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,20 @@ pub fn handle(irqs_pending: usize) -> Result<xous_kernel::Result, xous_kernel::E
|
||||||
Ok(xous_kernel::Result::ResumeProcess)
|
Ok(xous_kernel::Result::ResumeProcess)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn for_each_irq<F>(op: F)
|
||||||
|
where
|
||||||
|
F: Fn(usize, &PID, MemoryAddress, Option<MemoryAddress>),
|
||||||
|
{
|
||||||
|
unsafe {
|
||||||
|
for (idx, handler) in IRQ_HANDLERS.iter().enumerate() {
|
||||||
|
// Ignore threads that have no PC, and ignore the ISR thread
|
||||||
|
if let Some(handler) = handler {
|
||||||
|
op(idx, &handler.0, handler.1, handler.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn interrupt_claim(
|
pub fn interrupt_claim(
|
||||||
irq: usize,
|
irq: usize,
|
||||||
pid: PID,
|
pid: PID,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue