From a0fec13016faa1ce766bb2735ec759b159c8f95c Mon Sep 17 00:00:00 2001 From: bunnie Date: Wed, 29 May 2024 02:04:44 +0800 Subject: [PATCH] make the SwapOp syscall allowable to call in an interrupt context SwapOp is guaranteed to return eventually, so, it's technically not blocking; it's merely very slow. also fix a number of typos --- xous-rs/src/syscall.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/xous-rs/src/syscall.rs b/xous-rs/src/syscall.rs index 5922c4192..1430ec69c 100644 --- a/xous-rs/src/syscall.rs +++ b/xous-rs/src/syscall.rs @@ -484,11 +484,11 @@ pub enum SysCall { ReplyAndReceiveNext( MessageSender, /* ID if the sender that sent this message */ usize, /* Return code to the caller */ - usize, /* arg1 (BlockingScalar) or the memory address (MemoryMesage) */ - usize, /* arg2 (BlockingScalar) or the memory length (MemoryMesage) */ - usize, /* arg3 (BlockingScalar) or the memory offset (MemoryMesage) */ - usize, /* arg4 (BlockingScalar) or the memory valid (MemoryMesage) */ - usize, /* how many args are valid (BlockingScalar) or usize::MAX (MemoryMessge) */ + usize, /* arg1 (BlockingScalar) or the memory address (MemoryMessage) */ + usize, /* arg2 (BlockingScalar) or the memory length (MemoryMessage) */ + usize, /* arg3 (BlockingScalar) or the memory offset (MemoryMessage) */ + usize, /* arg4 (BlockingScalar) or the memory valid (MemoryMessage) */ + usize, /* how many args are valid (BlockingScalar) or usize::MAX (MemoryMessage) */ ), /// Returns the physical address corresponding to a virtual address for a given process, if such a @@ -1147,6 +1147,10 @@ impl SysCall { if let SysCall::TrySendMessage(_cid, msg) = self { return !msg.is_blocking(); } + #[cfg(feature = "swap")] + if let SysCall::SwapOp(_, _, _, _, _, _, _) = self { + return true; + } matches!( self, SysCall::TryConnect(_) @@ -1373,7 +1377,7 @@ pub fn create_server_with_sid(sid: SID) -> core::result::Result { /// Create a new server with a random name. This enables other processes to /// connect to this server to send messages. A random server ID is generated /// by the kernel and returned to the caller. This address can then be registered -/// to a namserver. +/// to a nameserver. /// /// # Errors /// @@ -1394,7 +1398,7 @@ pub fn create_server() -> core::result::Result { /// Fetch a random server ID from the kernel. This is used /// exclusively by the name server and the suspend/resume server. A random server ID is generated /// by the kernel and returned to the caller. This address can then be registered -/// to a namserver by the caller in their memory space. +/// to a nameserver by the caller in their memory space. /// /// The implementation is just a call to the kernel-exclusive TRNG to fetch random numbers. /// @@ -1466,7 +1470,7 @@ pub fn try_receive_message(server: SID) -> core::result::Result core::result::Result