class PhysMem

Defined at line 40 of file ../../src/virtualization/bin/vmm/device/phys_mem.h

Protected Members

vmo vmo_
size_t vmo_size_
zx_vaddr_t addr_
vmar child_vmar_

Public Methods

zx_status_t Init (zx::vmo vmo)

Initializes this PhysMem object with all of guest memory mapped into a child VMAR.

Defined at line 9 of file ../../src/virtualization/bin/vmm/device/phys_mem.cc

zx_status_t Init (const std::vector<GuestMemoryRegion> & guest_mem, zx::vmo vmo)

Initializes this PhysMem object with only valid guest memory regions mapped into a child VMAR.

Defined at line 24 of file ../../src/virtualization/bin/vmm/device/phys_mem.cc

const zx::vmo & vmo ()

Defined at line 50 of file ../../src/virtualization/bin/vmm/device/phys_mem.h

size_t size ()

Defined at line 51 of file ../../src/virtualization/bin/vmm/device/phys_mem.h

template <typename T>
T * aligned_as (zx_vaddr_t off, size_t bytes)

Requests a pointer to the guest memory at the given offset, valid for the

given number of bytes.

It is the caller's responsibility to only request offsets that are a

multiple of the object's alignment, otherwise this function will panic. If

alignment cannot be known you should either use `ptr` and copy in/out as

raw bytes, or use `read`, modify, and then `write`.

Defined at line 61 of file ../../src/virtualization/bin/vmm/device/phys_mem.h

void ~PhysMem ()

Defined at line 64 of file ../../src/virtualization/bin/vmm/device/phys_mem.cc

void * ptr (zx_vaddr_t off, size_t bytes)

Requests a raw pointer to the guest memory at the given offset, valid for

the given number of bytes.

Defined at line 70 of file ../../src/virtualization/bin/vmm/device/phys_mem.h

template <typename T>
T read (zx_vaddr_t off)

Read an object of type T from the guest memory.

This should only be used to read PoD objects.

Defined at line 79 of file ../../src/virtualization/bin/vmm/device/phys_mem.h

template <typename T>
void write (zx_vaddr_t off, const T & val)

Write an object of type T to the guest memory.

This should only be used to write PoD objects.

Defined at line 89 of file ../../src/virtualization/bin/vmm/device/phys_mem.h

template <typename T>
zx_vaddr_t offset (T * ptr, size_t bytes)

Defined at line 95 of file ../../src/virtualization/bin/vmm/device/phys_mem.h

template <typename T>
cpp20::span<T> span (zx_vaddr_t off, size_t count)

Requests a span covering the given range of memory.

Defined at line 104 of file ../../src/virtualization/bin/vmm/device/phys_mem.h