Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-vmm/vm-memory
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7be0764ff996c452ff451cd599382341900f4a38
Choose a base ref
..
head repository: rust-vmm/vm-memory
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8fd12ef321df549d1ca42b6a941019fe99743fa0
Choose a head ref
Showing with 10 additions and 10 deletions.
  1. +10 −10 src/io.rs
20 changes: 10 additions & 10 deletions src/io.rs
Original file line number Diff line number Diff line change
@@ -226,11 +226,11 @@ impl WriteVolatile for &mut [u8] {
// SAFETY:
// `buf` is contiguously allocated memory of length `total <= buf.len())` by the invariants
// of `VolatileSlice`.
// Furthermore, both src and dst of the call to
// copy_from_volatile_slice are valid for reads and writes respectively of length `total`
// since total is the minimum of lengths of the memory areas pointed to. The areas do not
// overlap, since dst is inside guest memory, and src is a pointer to a slice (no slices to
// guest memory are possible without violating rust's aliasing rules).
// Furthermore, both source and destination of the call to copy_from_volatile_slice are valid
// for reads and writes respectively of length `total` since total is the minimum of lengths
// of the memory areas pointed to. The areas do not overlap, since the source is inside guest
// memory, and the destination is a pointer derived from a slice (no slices to guest memory
// are possible without violating rust's aliasing rules).
let written = unsafe { copy_from_volatile_slice(self.as_mut_ptr(), buf, total) };

// Advance the slice, just like the stdlib: https://doc.rust-lang.org/src/std/io/impls.rs.html#335
@@ -265,11 +265,11 @@ impl ReadVolatile for &[u8] {
// SAFETY:
// `buf` is contiguously allocated memory of length `total <= buf.len())` by the invariants
// of `VolatileSlice`.
// Furthermore, both src and dst of the call to copy_to_volatile_slice are valid for reads
// and writes respectively of length `total` since total is the minimum of lengths of the
// memory areas pointed to. The areas do not overlap, since `dst` is inside guest memory,
// and src is a pointer to a slice (no slices to guest memory are possible without violating
// rust's aliasing rules).
// Furthermore, both source and destination of the call to copy_to_volatile_slice are valid
// for reads and writes respectively of length `total` since total is the minimum of lengths
// of the memory areas pointed to. The areas do not overlap, since the destination is inside
// guest memory, and the source is a pointer derived from a slice (no slices to guest memory
// are possible without violating rust's aliasing rules).
let read = unsafe { copy_to_volatile_slice(buf, self.as_ptr(), total) };

// Advance the slice, just like the stdlib: https://doc.rust-lang.org/src/std/io/impls.rs.html#232-310