mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
services: fix mutable references via as_slice_mut
The function `as_slice_mut()` takes a `MemoryRange` and returns a mutable slice. Previously, this could be called on a memory range that was not defined as `mut`. This will be fixed in `xous-rs` so that `as_slice_mut()` can only be called on a region that is defined as `mut`. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
759ddfedd6
commit
75fbf173a9
3 changed files with 5 additions and 5 deletions
|
|
@ -552,7 +552,7 @@ impl RootKeys {
|
||||||
fn debug_print_key(&self, offset: usize, num_bits: usize, name: &str) {
|
fn debug_print_key(&self, offset: usize, num_bits: usize, name: &str) {
|
||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
let mut debugstr = xous_ipc::String::<4096>::new();
|
let mut debugstr = xous_ipc::String::<4096>::new();
|
||||||
let sensitive_slice = self.sensitive_data.as_slice_mut::<u32>();
|
let sensitive_slice = self.sensitive_data.as_slice::<u32>();
|
||||||
write!(debugstr, "{}", name).unwrap();
|
write!(debugstr, "{}", name).unwrap();
|
||||||
for word in sensitive_slice[offset .. offset as usize + num_bits/(size_of::<u32>()*8)].iter() {
|
for word in sensitive_slice[offset .. offset as usize + num_bits/(size_of::<u32>()*8)].iter() {
|
||||||
for byte in word.to_be_bytes().iter() {
|
for byte in word.to_be_bytes().iter() {
|
||||||
|
|
@ -577,7 +577,7 @@ impl RootKeys {
|
||||||
|
|
||||||
// now get the font plane data
|
// now get the font plane data
|
||||||
self.gfx.bulk_read_restart(); // reset the bulk read pointers on the gfx side
|
self.gfx.bulk_read_restart(); // reset the bulk read pointers on the gfx side
|
||||||
let mut bulkread = BulkRead::default();
|
let bulkread = BulkRead::default();
|
||||||
let mut buf = xous_ipc::Buffer::into_buf(bulkread).expect("couldn't transform bulkread into aligned buffer");
|
let mut buf = xous_ipc::Buffer::into_buf(bulkread).expect("couldn't transform bulkread into aligned buffer");
|
||||||
// this form of loop was chosen to avoid the multiple re-initializations and copies that would be entailed
|
// this form of loop was chosen to avoid the multiple re-initializations and copies that would be entailed
|
||||||
// in our usual idiom for pasing buffers around. instead, we create a single buffer, and re-use it for
|
// in our usual idiom for pasing buffers around. instead, we create a single buffer, and re-use it for
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ impl<'a> ShellCmdApi<'a> for Keys {
|
||||||
|
|
||||||
log::debug!("top of region: {:x?}", ®ion[0..8]);
|
log::debug!("top of region: {:x?}", ®ion[0..8]);
|
||||||
// a region to stash a copy of the previous data in the testing area, so we can diff to confirm things worked!
|
// a region to stash a copy of the previous data in the testing area, so we can diff to confirm things worked!
|
||||||
let reference_region = xous::syscall::map_memory(
|
let mut reference_region = xous::syscall::map_memory(
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
TEST_SIZE,
|
TEST_SIZE,
|
||||||
|
|
|
||||||
|
|
@ -52,13 +52,13 @@ pub fn test_thread(sid0: usize, sid1: usize, sid2: usize, sid3: usize) {
|
||||||
log::debug!("memtest got msg {:?}", msg);
|
log::debug!("memtest got msg {:?}", msg);
|
||||||
match FromPrimitive::from_usize(msg.body.id()) {
|
match FromPrimitive::from_usize(msg.body.id()) {
|
||||||
Some(TestOp::StartBasic) => xous::msg_scalar_unpack!(msg, iters, _, _, _, {
|
Some(TestOp::StartBasic) => xous::msg_scalar_unpack!(msg, iters, _, _, _, {
|
||||||
let testsrc = xous::syscall::map_memory(
|
let mut testsrc = xous::syscall::map_memory(
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
256 * 1024, // min 128k so we are working through the L2 cache
|
256 * 1024, // min 128k so we are working through the L2 cache
|
||||||
xous::MemoryFlags::R | xous::MemoryFlags::W | xous::MemoryFlags::RESERVE,
|
xous::MemoryFlags::R | xous::MemoryFlags::W | xous::MemoryFlags::RESERVE,
|
||||||
).expect("couldn't allocate RAM for testing");
|
).expect("couldn't allocate RAM for testing");
|
||||||
let testdst = xous::syscall::map_memory(
|
let mut testdst = xous::syscall::map_memory(
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
256 * 1024,
|
256 * 1024,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue