mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-04 04:27:34 +00:00
kernel: services: allow unsetting exception handler
Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
5b2ac0df68
commit
d4675ef9cf
1 changed files with 13 additions and 5 deletions
|
|
@ -1573,7 +1573,7 @@ impl SystemServices {
|
|||
|
||||
// We cannot wait on ourselves.
|
||||
if tid == join_tid {
|
||||
return Err(xous_kernel::Error::ThreadNotAvailable)
|
||||
return Err(xous_kernel::Error::ThreadNotAvailable);
|
||||
}
|
||||
|
||||
// If the target thread exists, put this thread to sleep.
|
||||
|
|
@ -2133,9 +2133,17 @@ impl SystemServices {
|
|||
|
||||
/// Sets the exception handler for the given process ID. If an exception handler
|
||||
/// exists, it will be silently overridden.
|
||||
pub fn set_exception_handler(&mut self, pid: PID, pc: usize, sp: usize) -> Result<(), xous_kernel::Error> {
|
||||
let process = self.get_process_mut(pid)?;
|
||||
process.exception_handler = Some(ExceptionHandler { pc, sp });
|
||||
pub fn set_exception_handler(
|
||||
&mut self,
|
||||
pid: PID,
|
||||
pc: usize,
|
||||
sp: usize,
|
||||
) -> Result<(), xous_kernel::Error> {
|
||||
self.get_process_mut(pid)?.exception_handler = if pc != 0 && sp != 0 {
|
||||
Some(ExceptionHandler { pc, sp })
|
||||
} else {
|
||||
None
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -2167,7 +2175,7 @@ impl SystemServices {
|
|||
process.state = ProcessState::Running(threads & !(1 << tid));
|
||||
process.current_thread = tid;
|
||||
} else {
|
||||
return Err(xous_kernel::Error::ThreadNotAvailable.into())
|
||||
return Err(xous_kernel::Error::ThreadNotAvailable.into());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue