Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## Upcoming Release

## Removed

- \[[#374](https://github.com/rust-vmm/vm-memory/pull/374)\] Removed `ByteValued` trait and `endian` module in favor of the `zerocopy` crate.
`ByteValued`'s functionality is now provided by `zerocopy::IntoBytes`, `zerocopy::FromBytes` and `zerocopy::Zeroed`.
`ByteValued::as_bytes` can be replaced with `VolatileSlices::from` for `&mut [u8]`.

## 0.18.0

### Changed
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ bitflags = { version = "2.4.0", optional = true }
rangemap = { version = "1.5.1", optional = true }
thiserror = "2.0.16"
vmm-sys-util = { version = ">=0.12.1, <=0.15.0", optional = true }
zerocopy = "0.8.48"

[target.'cfg(target_family = "windows")'.dependencies.winapi]
version = "0.3"
Expand Down
17 changes: 1 addition & 16 deletions DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ The `vm-memory` is derived from two upstream projects:
The high level abstraction of the VM memory has been heavily refactored to
provide a VMM agnostic interface.

The `vm-memory` crate could be divided into four logic parts as:
The `vm-memory` crate could be divided into three logic parts as:

- [Abstraction of Address Space](#abstraction-of-address-space)
- [Specialization for Virtual Machine Physical Address Space](#specialization-for-virtual-machine-physical-address-space)
- [Backend Implementation Based on `mmap`](#backend-implementation-based-on-mmap)
- [Utilities and helpers](#utilities-and-helpers)

### Address Space Abstraction

Expand Down Expand Up @@ -146,20 +145,6 @@ object to translate I/O virtual addresses (IOVAs) into VMM user addresses
(VUAs), which are then passed to the inner `GuestMemoryBackend`
implementation (like `GuestMemoryMmap`).

### Utilities and Helpers

The following utilities and helper traits/macros are imported from the
[crosvm project](https://chromium.googlesource.com/chromiumos/platform/crosvm/)
with minor changes:

- `ByteValued` (originally `DataInit`): types which are safe to be initialized
from raw data. A type `T` is `ByteValued` if and only if it can be
initialized by reading its contents from a byte array. This is generally true
for all plain-old-data structs. It is notably not true for any type that
includes a reference.
- `{Le,Be}_{16,32,64}`: explicit endian types useful for embedding in structs
or reinterpreting data.

## Relationships between Traits, Structs and Types

**Traits**:
Expand Down
10 changes: 4 additions & 6 deletions benches/mmap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,27 @@ use std::path::Path;

use core::hint::black_box;
use criterion::Criterion;
use zerocopy::{FromBytes, IntoBytes};

use vm_memory::{ByteValued, Bytes, GuestAddress, GuestMemoryBackend};
use vm_memory::{Bytes, GuestAddress, GuestMemoryBackend};

const REGION_SIZE: usize = 0x8000_0000;
const REGIONS_COUNT: u64 = 8;
const ACCESS_SIZE: usize = 0x200;

#[repr(C)]
#[derive(Copy, Clone, Default)]
#[derive(Copy, Clone, Default, FromBytes, IntoBytes)]
struct SmallDummy {
a: u32,
b: u32,
}
unsafe impl ByteValued for SmallDummy {}

#[repr(C)]
#[derive(Copy, Clone, Default)]
#[derive(Copy, Clone, Default, FromBytes, IntoBytes)]
struct BigDummy {
elements: [u64; 12],
}

unsafe impl ByteValued for BigDummy {}

fn make_image(size: usize) -> Vec<u8> {
let mut image: Vec<u8> = Vec::with_capacity(size);
for i in 0..size {
Expand Down
2 changes: 1 addition & 1 deletion coverage_config_x86_64.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"coverage_score": 90.56,
"coverage_score": 89.86,
"exclude_path": "mmap_windows.rs",
"crate_features": "backend-mmap,backend-atomic,backend-bitmap,iommu"
}
Loading