From b74396cfe7d96a660beb3c3ce2ab60e6b9609f1d Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Wed, 12 May 2021 21:15:34 +0800 Subject: [PATCH] syscall: add return_memory_offset_valid() This sets the `valid` field in addition to the `offset` field when returning a MemoryMessage. Signed-off-by: Sean Cross --- xous-rs/src/syscall.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/xous-rs/src/syscall.rs b/xous-rs/src/syscall.rs index 6d5deb081..273b6d4e3 100644 --- a/xous-rs/src/syscall.rs +++ b/xous-rs/src/syscall.rs @@ -1060,6 +1060,24 @@ pub fn return_memory_offset( } } +/// Map the given physical address to the given virtual address. +/// The `size` field must be page-aligned. +pub fn return_memory_offset_valid( + sender: MessageSender, + mem: MemoryRange, + offset: Option, + valid: Option, +) -> core::result::Result<(), Error> { + let result = rsyscall(SysCall::ReturnMemory(sender, mem, offset, valid))?; + if let crate::Result::Ok = result { + Ok(()) + } else if let Result::Error(e) = result { + Err(e) + } else { + Err(Error::InternalError) + } +} + /// Map the given physical address to the given virtual address. /// The `size` field must be page-aligned. pub fn return_scalar(sender: MessageSender, val: usize) -> core::result::Result<(), Error> {