Skip to main content

ArmVcpuTimer

Struct ArmVcpuTimer 

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

Timer state owned by one vCPU.

Implementations§

Source§

impl ArmVcpuTimer

Source

pub const fn new( config: ArmTimerVmConfig, guest_hypervisor_control: u64, ) -> Self

Creates reset timer state for one vCPU.

Source

pub fn snapshot(&self) -> ArmVcpuResult<ArmTimerSnapshot>

Returns an immutable snapshot while the timer is not loaded.

Source

pub fn context_mut( &mut self, kind: ArmTimerKind, ) -> ArmVcpuResult<&mut ArmTimerContext>

Returns a mutable timer context while the timer is not loaded.

Source

pub const fn config(&self) -> ArmTimerVmConfig

Returns the VM-wide timer configuration.

Source

pub fn guest_counter( &self, kind: ArmTimerKind, physical_counter: u64, ) -> ArmVcpuResult<u64>

Reads one guest counter from the host physical counter.

Source

pub fn read_control( &self, kind: ArmTimerKind, physical_counter: u64, ) -> ArmVcpuResult<u32>

Reads one timer’s control register.

Source

pub fn read_tval( &self, kind: ArmTimerKind, physical_counter: u64, ) -> ArmVcpuResult<u32>

Reads one timer’s timer-value register.

Source

pub fn read_compare(&self, kind: ArmTimerKind) -> ArmVcpuResult<u64>

Reads one timer’s compare-value register.

Source

pub fn write_control(&mut self, kind: ArmTimerKind, value: u32) -> ArmVcpuResult

Writes one timer’s control register.

Source

pub fn write_tval( &mut self, kind: ArmTimerKind, physical_counter: u64, value: u32, ) -> ArmVcpuResult

Writes one timer’s timer-value register.

Source

pub fn write_compare(&mut self, kind: ArmTimerKind, value: u64) -> ArmVcpuResult

Writes one timer’s compare-value register.

Source

pub fn load(&mut self, registers: &mut impl ArmTimerRegisters) -> ArmVcpuResult

Loads the direct virtual timer into hardware.

Source

pub fn put(&mut self, registers: &mut impl ArmTimerRegisters) -> ArmVcpuResult

Saves and stops the direct virtual timer before restoring the host epoch.

Source

pub fn reset(&mut self) -> ArmVcpuResult

Resets both timer contexts.

Trait Implementations§

Source§

impl Debug for ArmVcpuTimer

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<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>,

Source§

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>,

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.