Turns out we didn't end up needing this capability, so, commenting it
out because it is a shy too powerful and is like packing a live
mortar shell in a storage unit: eventually, someone is going to
get hurt, even though it seems mostly harmless at the moment.

Code just commented out in case we need this feature in the future,
but, the main reason it was asked for (the PDDB) was accomplished
without it.
This commit is contained in:
bunnie 2022-02-02 00:37:57 +08:00
parent f3e3c5cc18
commit 002e098538
3 changed files with 10 additions and 4 deletions

View file

@ -2178,7 +2178,7 @@ impl SystemServices {
}
Ok(())
}
/* https://github.com/betrusted-io/xous-core/issues/90
/// Sets the exception handler for the given process ID. If an exception handler
/// exists, it will be silently overridden.
pub fn set_exception_handler(
@ -2194,6 +2194,7 @@ impl SystemServices {
};
Ok(())
}
*/
/// Causes the provided process to go into an exception state. This will fail
/// if any of the following are true:

View file

@ -884,10 +884,12 @@ pub fn handle_inner(pid: PID, tid: TID, in_irq: bool, call: SysCall) -> SysCallR
ret
})
}
/* https://github.com/betrusted-io/xous-core/issues/90
SysCall::SetExceptionHandler(pc, sp) => SystemServices::with_mut(|ss| {
ss.set_exception_handler(pid, pc, sp)
.and(Ok(xous_kernel::Result::Ok))
}),
*/
_ => Err(xous_kernel::Error::UnhandledSyscall),
}
}

View file

@ -1,9 +1,12 @@
use crate::{
pid_from_usize, CpuID, Error, Exception, MemoryAddress, MemoryFlags, MemoryMessage,
pid_from_usize, CpuID, Error, MemoryAddress, MemoryFlags, MemoryMessage,
MemoryRange, MemorySize, MemoryType, Message, MessageEnvelope, MessageSender, ProcessArgs,
ProcessInit, Result, ScalarMessage, SysCallResult, ThreadInit, CID, PID, SID, TID,
};
use core::convert::{TryFrom, TryInto};
/* https://github.com/betrusted-io/xous-core/issues/90
use crate::Exception
*/
// use num_derive::FromPrimitive;
// use num_traits::FromPrimitive;
@ -1627,7 +1630,7 @@ pub fn join_thread(tid: TID) -> core::result::Result<usize, Error> {
}
})
}
/* https://github.com/betrusted-io/xous-core/issues/90
static EXCEPTION_HANDLER: core::sync::atomic::AtomicUsize = core::sync::atomic::AtomicUsize::new(0);
fn handle_exception(exception_type: usize, arg1: usize, arg2: usize) -> isize {
let exception = crate::exceptions::Exception::new(exception_type, arg1, arg2);
@ -1635,7 +1638,6 @@ fn handle_exception(exception_type: usize, arg1: usize, arg2: usize) -> isize {
let f = unsafe { core::mem::transmute::<usize, fn(Exception) -> isize>(f) };
f(exception)
}
/// Sets the given function as this process' Exception handler. This function
/// will be called whenever an Exception occurs such as a memory fault,
/// illegal instruction, or a child process terminating.
@ -1663,6 +1665,7 @@ pub fn set_exception_handler(
}
})
}
*/
/// Perform a raw syscall and return the result. This will transform
/// `xous::Result::Error(e)` into an `Err(e)`.