pub struct VMHandle { /* private fields */ }
Expand description

Handle to a KVM VM

This is a handle to a single KVM instance. Allows access to basic memory layout information of the VM.

Implementations§

source§

impl VMHandle

source

pub fn try_open_handle(memflow: &ModuleHandle, pid: Option<i32>) -> Result<Self>

Open a KVM instance with a memflow handle

This may be useful when multiple VMs are accessed to save syscalls, but in regular scenarios, use try_open.

Arguments
  • memflow - handle to the memflow driver
  • pid - optional process identifier. If it is None, or Some(0), handle to any of the KVM VMs gets retrieved.
source

pub fn try_open(pid: Option<i32>) -> Result<Self>

Open a KVM instance

Arguments
  • pid - optional process identifier. If it is None, or Some(0), handle to any of the KVM VMs gets retrieved. Otherwise, the specific PID gets targeted. And if the process does not exist, this function will fail.
source

pub fn info(&self, slot_count: usize) -> Result<(i32, Vec<vm_memslot>)>

Retrieve info about the KVM instance

Pulls info about the current VM handle. That means its PID, and the memory layout (in KVMs userspace).

source

pub fn map_vm(&self, slot_count: usize) -> Result<Vec<vm_memslot>>

Memory map the KVM instance

Maps the memory of the KVM instance into local address space, and returns the mapped memory layout.

The memory map is permanent (unless manually unmapped using libc). KVM has the possibility of changing the memory layout (in its process only), but this function can not account for it.

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<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.