From bb304d412a83404d4a92ba49adf6f1e8215b902b Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Sun, 1 Nov 2020 16:26:33 +0800 Subject: [PATCH] xous: add can_call_from_interrupt() to SysCall This function can be used to determine if a particular syscall may be called from an interrupt context. Signed-off-by: Sean Cross --- xous-rs/src/syscall.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xous-rs/src/syscall.rs b/xous-rs/src/syscall.rs index 2e2428fde..c86dd180a 100644 --- a/xous-rs/src/syscall.rs +++ b/xous-rs/src/syscall.rs @@ -847,6 +847,16 @@ impl SysCall { _ => None, } } + + /// Returns `true` if the given syscall may be called from an IRQ context + pub fn can_call_from_interrupt(&self) -> bool { + matches!(self, SysCall::TrySendMessage(_, _) + | SysCall::TryConnect(_) + | SysCall::ReturnToParent(_, _) + | SysCall::ReturnScalar2(_, _, _) + | SysCall::ReturnScalar1(_, _) + | SysCall::ReturnMemory(_, _)) + } } extern "Rust" {