diff --git a/src/libio/cursor.rs b/src/libio/cursor.rs index bd397ac7..46ff6d63 100644 --- a/src/libio/cursor.rs +++ b/src/libio/cursor.rs @@ -2,6 +2,7 @@ use alloc::vec::Vec; use core_io::{Error as IoError, Read, Write}; +use core::arch::asm; #[derive(Debug, Clone)] pub struct Cursor { @@ -47,6 +48,7 @@ impl> Read for Cursor { let len = buf.len().min(data.len()); // ``copy_from_slice`` generates AXI bursts, use a regular loop instead for i in 0..len { + unsafe { asm!("", options(preserves_flags, nostack, readonly)); } buf[i] = data[i]; } self.pos += len; @@ -59,6 +61,7 @@ impl Write for Cursor<&mut [u8]> { let data = &mut self.inner[self.pos..]; let len = buf.len().min(data.len()); for i in 0..len { + unsafe { asm!("", options(preserves_flags, nostack, readonly)); } data[i] = buf[i]; } self.pos += len; diff --git a/src/libio/lib.rs b/src/libio/lib.rs index 7abe5c10..70c2384c 100644 --- a/src/libio/lib.rs +++ b/src/libio/lib.rs @@ -1,5 +1,6 @@ #![no_std] #![feature(never_type)] +#![feature(asm)] #[cfg(feature = "alloc")] extern crate alloc;