pub struct MappedMemory { /* private fields */ }Expand description
Guest RAM that is mapped into the current process, described by the same slot table KVM uses.
§Examples
use kvmtrace::memory::{GuestMemory, MappedMemory};
let mut ram = vec![0u8; 4096];
let mem = MappedMemory::new();
// SAFETY: `ram` outlives `mem` and is not resized.
unsafe { mem.set_region(0, 0x1000, ram.len() as u64, ram.as_mut_ptr() as usize) };
mem.write(0x1008, &[0xAA]).unwrap();
let mut b = [0u8; 1];
mem.read(0x1008, &mut b).unwrap();
assert_eq!(b[0], 0xAA);
assert!(mem.read(0x0, &mut b).is_err()); // not RAMImplementations§
Source§impl MappedMemory
impl MappedMemory
Trait Implementations§
Source§impl Debug for MappedMemory
impl Debug for MappedMemory
Source§impl Default for MappedMemory
impl Default for MappedMemory
Auto Trait Implementations§
impl !Freeze for MappedMemory
impl RefUnwindSafe for MappedMemory
impl Send for MappedMemory
impl Sync for MappedMemory
impl Unpin for MappedMemory
impl UnsafeUnpin for MappedMemory
impl UnwindSafe for MappedMemory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more