kernel: make disable_irq() infallible

This function never failed. Make it infallible so that it matches the
same calling convention as `enable_irq()`

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2023-02-28 09:39:18 +08:00
parent 787d77fcbd
commit 02065a6a0b
3 changed files with 12 additions and 6 deletions

View file

@ -7,7 +7,7 @@ pub fn enable_irq(_irq_no: usize) {
unimplemented!()
}
pub fn disable_irq(_irq_no: usize) -> Result<(), xous_kernel::Error> {
pub fn disable_irq(_irq_no: usize) {
unimplemented!()
}

View file

@ -34,9 +34,8 @@ pub fn enable_irq(irq_no: usize) {
sim::write(sim::read() | (1 << irq_no));
}
pub fn disable_irq(irq_no: usize) -> Result<(), xous_kernel::Error> {
pub fn disable_irq(irq_no: usize) {
sim::write(sim::read() & !(1 << irq_no));
Ok(())
}
static mut PREVIOUS_PAIR: Option<(PID, TID)> = None;
@ -331,6 +330,13 @@ pub extern "C" fn trap_handler(
// If it's not a failure in the kernel, terminate or debug the current process.
SystemServices::with_mut(|ss| {
#[cfg(feature = "gdb-stub")]
{
ss.suspend_process(pid)
.expect("couldn't debug current process");
println!("Program suspended. You may inspect it using gdb.");
}
#[cfg(not(feature = "gdb-stub"))]
ss.terminate_process(pid)
.expect("couldn't terminate current process");
crate::syscall::reset_switchto_caller();

View file

@ -37,7 +37,7 @@ pub fn handle(irqs_pending: usize) -> Result<xous_kernel::Result, xous_kernel::E
// If there is no handler, mask this interrupt
// to prevent an IRQ storm. This is considered
// an error.
arch::irq::disable_irq(irq_no)?;
arch::irq::disable_irq(irq_no);
}
}
}
@ -90,7 +90,7 @@ pub fn interrupt_free(irq: usize, pid: PID) -> Result<(), xous_kernel::Error> {
} else if !IRQ_HANDLERS[irq].map(|f| f.0 == pid).unwrap_or(false) {
Err(xous_kernel::Error::InterruptNotFound)
} else {
arch::irq::disable_irq(irq).unwrap();
arch::irq::disable_irq(irq);
IRQ_HANDLERS[irq] = None;
Ok(())
}
@ -104,7 +104,7 @@ pub fn release_interrupts_for_pid(pid: PID) {
for (irq, handler) in IRQ_HANDLERS.iter_mut().enumerate() {
if let Some(h) = handler {
if h.0 == pid {
arch::irq::disable_irq(irq).unwrap();
arch::irq::disable_irq(irq);
*handler = None;
}
}