struct WorldMemory {
world_id: u64,
}Expand description
World-facing memory adapter: linear guest-physical accesses through the world translation, page by page.
Fields§
§world_id: u64Implementations§
Source§impl WorldMemory
impl WorldMemory
const fn new(world_id: u64) -> Self
Sourcefn read_bytes(&mut self, linear: u32, out: &mut [u8]) -> bool
fn read_bytes(&mut self, linear: u32, out: &mut [u8]) -> bool
Reads out.len() bytes at linear address linear.
Sourcefn write_bytes(&mut self, linear: u32, bytes: &[u8]) -> bool
fn write_bytes(&mut self, linear: u32, bytes: &[u8]) -> bool
Writes bytes at linear address linear.
Sourcefn page(&self, linear: u64) -> Option<*mut u8>
fn page(&self, linear: u64) -> Option<*mut u8>
HHDM pointer to the page containing linear (linear page-aligned).
Sourcefn read_physical(&mut self, phys: u64, out: &mut [u8]) -> bool
fn read_physical(&mut self, phys: u64, out: &mut [u8]) -> bool
Reads out.len() bytes at host-physical address phys.
The device fast path receives addresses that the second-level walk has
already resolved, so they must not go through vm::debug_translate
a second time: the higher-half direct map is the correct window. It is
linear, so a page split is unnecessary, but the access stays byte-wise
and volatile like the guest-physical one.
Sourcefn write_physical(&mut self, phys: u64, bytes: &[u8]) -> bool
fn write_physical(&mut self, phys: u64, bytes: &[u8]) -> bool
Writes bytes at host-physical address phys.
Trait Implementations§
Source§impl BiosMemory for WorldMemory
impl BiosMemory for WorldMemory
Source§fn read_u8(&mut self, linear: u32) -> Option<u8>
fn read_u8(&mut self, linear: u32) -> Option<u8>
None when the address is not readable.Source§fn write_u8(&mut self, linear: u32, value: u8) -> bool
fn write_u8(&mut self, linear: u32, value: u8) -> bool
false when the address is not writable.Source§impl PhysMemory for WorldMemory
Physical view of the world for the device fast path.
impl PhysMemory for WorldMemory
Physical view of the world for the device fast path.
emulate::MemoryView resolves a guest address through the second-level
tables and then asks emulate::PhysMemory for the resulting host-physical
bytes. The adapter therefore uses the direct-map accessors: forwarding to
the guest-physical read_bytes/write_bytes would translate the address a
second time (as if it were a GPA) and silently break every replayed access.
Source§impl RomMemory for WorldMemory
impl RomMemory for WorldMemory
Source§fn write(&mut self, linear: u32, bytes: &[u8]) -> bool
fn write(&mut self, linear: u32, bytes: &[u8]) -> bool
bytes at linear. Returns false when the range is not
writable or not mapped.Source§fn read(&mut self, linear: u32, out: &mut [u8]) -> bool
fn read(&mut self, linear: u32, out: &mut [u8]) -> bool
out.len() bytes from linear. Returns false when the range is
not readable or not mapped.Auto Trait Implementations§
impl Forget for WorldMemory
impl Freeze for WorldMemory
impl Move for WorldMemory
impl RefUnwindSafe for WorldMemory
impl Send for WorldMemory
impl Sync for WorldMemory
impl Unpin for WorldMemory
impl UnsafeUnpin for WorldMemory
impl UnwindSafe for WorldMemory
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more