mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
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:
parent
787d77fcbd
commit
02065a6a0b
3 changed files with 12 additions and 6 deletions
|
|
@ -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!()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue