Skip to main content

VirtioMemoryRange

Struct VirtioMemoryRange 

Source
pub struct VirtioMemoryRange { /* private fields */ }
Expand description

Describes a memory region accessible by a virtio device.

The memory region is contiguous in the PCI device’s physical address space. If no IOMMU is involved, the PCI device’s physical address space is the same as the CPU physical address space visible to the guest (virtualized) OS.

Each instance describes a memory region that is submitted (owned by the device) or is about to be submitted (owned by the device). Device ownership is conceptually equivalent to a Rust mutable reference covering the entire memory range. Here are two immediate implications:

  1. No Rust references may point into a range described by an instance.
  2. The memory ranges described by any two instances must not overlap.

Implementations§

Source§

impl VirtioMemoryRange

Source

pub unsafe fn new( start_physical_address: u64, size: NonZero<u32>, device_access: VirtioMemoryRangeAccess, ) -> VirtioMemoryRange

Describes a memory range that will be submitted to a virtio device.

§Safety

start_physical_address and size must identify a valid range of memory that is contiguous in the PCI virtio device’s physical address space. The newly created instance must be treated like a mutable Rust reference covering the entire memory range.

Source

pub fn start_physical_address(&self) -> u64

Points to the first byte in the memory region.

Uses the PCI device’s physical addressable space.

Source

pub fn size(&self) -> NonZero<u32>

The number of bytes that make up the contiguous region.

Source

pub fn device_access(&self) -> VirtioMemoryRangeAccess

Constrains a device’s accesses to the memory range.

Trait Implementations§

Source§

impl Debug for VirtioMemoryRange

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> InstanceFromServiceTransport<T> for T

§

fn from_service_transport(handle: T) -> T

Converts the given service transport handle of type T to [Self]
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<E> RunsTransport<Mpsc> for E

§

impl<E> RunsTransport<Mpsc> for E
where E: RunsTransport<Mpsc>,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.