mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-21 09:14:34 +00:00
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.
This commit is contained in:
parent
f3e3c5cc18
commit
002e098538
3 changed files with 10 additions and 4 deletions
|
|
@ -2178,7 +2178,7 @@ impl SystemServices {
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
/* https://github.com/betrusted-io/xous-core/issues/90
|
||||||
/// Sets the exception handler for the given process ID. If an exception handler
|
/// Sets the exception handler for the given process ID. If an exception handler
|
||||||
/// exists, it will be silently overridden.
|
/// exists, it will be silently overridden.
|
||||||
pub fn set_exception_handler(
|
pub fn set_exception_handler(
|
||||||
|
|
@ -2194,6 +2194,7 @@ impl SystemServices {
|
||||||
};
|
};
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/// Causes the provided process to go into an exception state. This will fail
|
/// Causes the provided process to go into an exception state. This will fail
|
||||||
/// if any of the following are true:
|
/// if any of the following are true:
|
||||||
|
|
|
||||||
|
|
@ -884,10 +884,12 @@ pub fn handle_inner(pid: PID, tid: TID, in_irq: bool, call: SysCall) -> SysCallR
|
||||||
ret
|
ret
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
/* https://github.com/betrusted-io/xous-core/issues/90
|
||||||
SysCall::SetExceptionHandler(pc, sp) => SystemServices::with_mut(|ss| {
|
SysCall::SetExceptionHandler(pc, sp) => SystemServices::with_mut(|ss| {
|
||||||
ss.set_exception_handler(pid, pc, sp)
|
ss.set_exception_handler(pid, pc, sp)
|
||||||
.and(Ok(xous_kernel::Result::Ok))
|
.and(Ok(xous_kernel::Result::Ok))
|
||||||
}),
|
}),
|
||||||
|
*/
|
||||||
_ => Err(xous_kernel::Error::UnhandledSyscall),
|
_ => Err(xous_kernel::Error::UnhandledSyscall),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
use crate::{
|
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,
|
MemoryRange, MemorySize, MemoryType, Message, MessageEnvelope, MessageSender, ProcessArgs,
|
||||||
ProcessInit, Result, ScalarMessage, SysCallResult, ThreadInit, CID, PID, SID, TID,
|
ProcessInit, Result, ScalarMessage, SysCallResult, ThreadInit, CID, PID, SID, TID,
|
||||||
};
|
};
|
||||||
use core::convert::{TryFrom, TryInto};
|
use core::convert::{TryFrom, TryInto};
|
||||||
|
/* https://github.com/betrusted-io/xous-core/issues/90
|
||||||
|
use crate::Exception
|
||||||
|
*/
|
||||||
|
|
||||||
// use num_derive::FromPrimitive;
|
// use num_derive::FromPrimitive;
|
||||||
// use num_traits::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);
|
static EXCEPTION_HANDLER: core::sync::atomic::AtomicUsize = core::sync::atomic::AtomicUsize::new(0);
|
||||||
fn handle_exception(exception_type: usize, arg1: usize, arg2: usize) -> isize {
|
fn handle_exception(exception_type: usize, arg1: usize, arg2: usize) -> isize {
|
||||||
let exception = crate::exceptions::Exception::new(exception_type, arg1, arg2);
|
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) };
|
let f = unsafe { core::mem::transmute::<usize, fn(Exception) -> isize>(f) };
|
||||||
f(exception)
|
f(exception)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the given function as this process' Exception handler. This function
|
/// Sets the given function as this process' Exception handler. This function
|
||||||
/// will be called whenever an Exception occurs such as a memory fault,
|
/// will be called whenever an Exception occurs such as a memory fault,
|
||||||
/// illegal instruction, or a child process terminating.
|
/// 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
|
/// Perform a raw syscall and return the result. This will transform
|
||||||
/// `xous::Result::Error(e)` into an `Err(e)`.
|
/// `xous::Result::Error(e)` into an `Err(e)`.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue