From 002e09853892927130f5e193c9922a805896d551 Mon Sep 17 00:00:00 2001 From: bunnie Date: Wed, 2 Feb 2022 00:37:57 +0800 Subject: [PATCH] Fix issue #90 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. --- kernel/src/services.rs | 3 ++- kernel/src/syscall.rs | 2 ++ xous-rs/src/syscall.rs | 9 ++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/kernel/src/services.rs b/kernel/src/services.rs index c61ec16e4..6eea76b6c 100644 --- a/kernel/src/services.rs +++ b/kernel/src/services.rs @@ -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: diff --git a/kernel/src/syscall.rs b/kernel/src/syscall.rs index 3a8f3f991..fb42a3038 100644 --- a/kernel/src/syscall.rs +++ b/kernel/src/syscall.rs @@ -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), } } diff --git a/xous-rs/src/syscall.rs b/xous-rs/src/syscall.rs index 5650b29e6..0b80a3648 100644 --- a/xous-rs/src/syscall.rs +++ b/xous-rs/src/syscall.rs @@ -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 { } }) } - +/* 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:: 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)`.