diff --git a/xous-rs/src/arch/hosted.rs b/xous-rs/src/arch/hosted.rs index 5d109717b..45a897e1e 100644 --- a/xous-rs/src/arch/hosted.rs +++ b/xous-rs/src/arch/hosted.rs @@ -520,49 +520,54 @@ fn _xous_syscall_result( // println!(" Waiting again"); continue; } - if let crate::SysCall::SendMessage(_, ref msg) = call { - match msg { - crate::Message::MutableBorrow(crate::MemoryMessage { - id: _id, - buf, - offset: _offset, - valid: _valid, - }) => { - // Read the buffer back from the remote host. - use core::slice; - let mut data = - unsafe { slice::from_raw_parts_mut(buf.addr.get() as _, buf.size.get()) }; - stream.read_exact(&mut data).expect("Server shut down"); - // pkt.extend_from_slice(data); + match &call { + crate::SysCall::SendMessage(_, msg) | crate::SysCall::TrySendMessage(_, msg) => { + match msg { + crate::Message::MutableBorrow(crate::MemoryMessage { + id: _id, + buf, + offset: _offset, + valid: _valid, + }) => { + // Read the buffer back from the remote host. + use core::slice; + let mut data = unsafe { + slice::from_raw_parts_mut(buf.addr.get() as _, buf.size.get()) + }; + stream.read_exact(&mut data).expect("Server shut down"); + // pkt.extend_from_slice(data); + } + + crate::Message::Borrow(crate::MemoryMessage { + id: _id, + buf, + offset: _offset, + valid: _valid, + }) => { + // Read the buffer back from the remote host and ensure it's the same + use core::slice; + let mut check_data = Vec::new(); + check_data.resize(buf.len(), 0); + let data = + unsafe { slice::from_raw_parts_mut(buf.as_mut_ptr(), buf.len()) }; + stream + .read_exact(&mut check_data) + .expect("Server shut down"); + + assert_eq!(data, check_data.as_slice()); + } + + crate::Message::Move(crate::MemoryMessage { + id: _id, + buf: _buf, + offset: _offset, + valid: _valid, + }) => (), + // Nothing to do for Immutable borrow, since the memory can't change + crate::Message::Scalar(_) => (), } - - crate::Message::Borrow(crate::MemoryMessage { - id: _id, - buf, - offset: _offset, - valid: _valid, - }) => { - // Read the buffer back from the remote host and ensure it's the same - use core::slice; - let mut check_data = Vec::new(); - check_data.resize(buf.len(), 0); - let data = unsafe { slice::from_raw_parts_mut(buf.as_mut_ptr(), buf.len()) }; - stream - .read_exact(&mut check_data) - .expect("Server shut down"); - - assert_eq!(data, check_data.as_slice()); - } - - crate::Message::Move(crate::MemoryMessage { - id: _id, - buf: _buf, - offset: _offset, - valid: _valid, - }) => (), - // Nothing to do for Immutable borrow, since the memory can't change - crate::Message::Scalar(_) => (), } + _ => (), } // Now that we have the Stream mutex, temporarily take the Mailbox mutex to see if