mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +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!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn disable_irq(_irq_no: usize) -> Result<(), xous_kernel::Error> {
|
pub fn disable_irq(_irq_no: usize) {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,8 @@ pub fn enable_irq(irq_no: usize) {
|
||||||
sim::write(sim::read() | (1 << irq_no));
|
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));
|
sim::write(sim::read() & !(1 << irq_no));
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static mut PREVIOUS_PAIR: Option<(PID, TID)> = None;
|
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.
|
// If it's not a failure in the kernel, terminate or debug the current process.
|
||||||
SystemServices::with_mut(|ss| {
|
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)
|
ss.terminate_process(pid)
|
||||||
.expect("couldn't terminate current process");
|
.expect("couldn't terminate current process");
|
||||||
crate::syscall::reset_switchto_caller();
|
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
|
// If there is no handler, mask this interrupt
|
||||||
// to prevent an IRQ storm. This is considered
|
// to prevent an IRQ storm. This is considered
|
||||||
// an error.
|
// 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) {
|
} else if !IRQ_HANDLERS[irq].map(|f| f.0 == pid).unwrap_or(false) {
|
||||||
Err(xous_kernel::Error::InterruptNotFound)
|
Err(xous_kernel::Error::InterruptNotFound)
|
||||||
} else {
|
} else {
|
||||||
arch::irq::disable_irq(irq).unwrap();
|
arch::irq::disable_irq(irq);
|
||||||
IRQ_HANDLERS[irq] = None;
|
IRQ_HANDLERS[irq] = None;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
@ -104,7 +104,7 @@ pub fn release_interrupts_for_pid(pid: PID) {
|
||||||
for (irq, handler) in IRQ_HANDLERS.iter_mut().enumerate() {
|
for (irq, handler) in IRQ_HANDLERS.iter_mut().enumerate() {
|
||||||
if let Some(h) = handler {
|
if let Some(h) = handler {
|
||||||
if h.0 == pid {
|
if h.0 == pid {
|
||||||
arch::irq::disable_irq(irq).unwrap();
|
arch::irq::disable_irq(irq);
|
||||||
*handler = None;
|
*handler = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue