about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSean Cross <sean@xobs.io>2023-12-29 19:06:46 +0800
committerSean Cross <sean@xobs.io>2024-01-13 09:13:56 -0800
commitf732d2bfe293349bd3a7b7d8a2211a8058d3fb31 (patch)
treebda7bf08882abfa055ee3638f355c350308f3e86
parent626926f073997af4c9bd971c827eece6cfa26bb2 (diff)
downloadrust-f732d2bfe293349bd3a7b7d8a2211a8058d3fb31.tar.gz
rust-f732d2bfe293349bd3a7b7d8a2211a8058d3fb31.zip
std: xous: pass entire memory range to flag updater
When updating memory flags via `update_memory_flags()`, ensure we
multiply the slice length by the element size to get the full memory
size.

Signed-off-by: Sean Cross <sean@xobs.io>
-rw-r--r--library/std/src/os/xous/ffi.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/std/src/os/xous/ffi.rs b/library/std/src/os/xous/ffi.rs
index 1df4fbab7f7..7fe84db515c 100644
--- a/library/std/src/os/xous/ffi.rs
+++ b/library/std/src/os/xous/ffi.rs
@@ -452,7 +452,7 @@ pub(crate) unsafe fn update_memory_flags<T>(
 ) -> Result<(), Error> {
     let mut a0 = Syscall::UpdateMemoryFlags as usize;
     let mut a1 = range.as_mut_ptr() as usize;
-    let a2 = range.len();
+    let a2 = range.len() * core::mem::size_of::<T>();
     let a3 = new_flags.bits();
     let a4 = 0; // Process ID is currently None
     let a5 = 0;