pub struct ArmVcpuTimer { /* private fields */ }Expand description
Timer state owned by one vCPU.
Implementations§
Source§impl ArmVcpuTimer
impl ArmVcpuTimer
Sourcepub const fn new(
config: ArmTimerVmConfig,
guest_hypervisor_control: u64,
) -> Self
pub const fn new( config: ArmTimerVmConfig, guest_hypervisor_control: u64, ) -> Self
Creates reset timer state for one vCPU.
Sourcepub fn snapshot(&self) -> ArmVcpuResult<ArmTimerSnapshot>
pub fn snapshot(&self) -> ArmVcpuResult<ArmTimerSnapshot>
Returns an immutable snapshot while the timer is not loaded.
Sourcepub fn context_mut(
&mut self,
kind: ArmTimerKind,
) -> ArmVcpuResult<&mut ArmTimerContext>
pub fn context_mut( &mut self, kind: ArmTimerKind, ) -> ArmVcpuResult<&mut ArmTimerContext>
Returns a mutable timer context while the timer is not loaded.
Sourcepub const fn config(&self) -> ArmTimerVmConfig
pub const fn config(&self) -> ArmTimerVmConfig
Returns the VM-wide timer configuration.
Sourcepub fn guest_counter(
&self,
kind: ArmTimerKind,
physical_counter: u64,
) -> ArmVcpuResult<u64>
pub fn guest_counter( &self, kind: ArmTimerKind, physical_counter: u64, ) -> ArmVcpuResult<u64>
Reads one guest counter from the host physical counter.
Sourcepub fn read_control(
&self,
kind: ArmTimerKind,
physical_counter: u64,
) -> ArmVcpuResult<u32>
pub fn read_control( &self, kind: ArmTimerKind, physical_counter: u64, ) -> ArmVcpuResult<u32>
Reads one timer’s control register.
Sourcepub fn read_tval(
&self,
kind: ArmTimerKind,
physical_counter: u64,
) -> ArmVcpuResult<u32>
pub fn read_tval( &self, kind: ArmTimerKind, physical_counter: u64, ) -> ArmVcpuResult<u32>
Reads one timer’s timer-value register.
Sourcepub fn read_compare(&self, kind: ArmTimerKind) -> ArmVcpuResult<u64>
pub fn read_compare(&self, kind: ArmTimerKind) -> ArmVcpuResult<u64>
Reads one timer’s compare-value register.
Sourcepub fn write_control(&mut self, kind: ArmTimerKind, value: u32) -> ArmVcpuResult
pub fn write_control(&mut self, kind: ArmTimerKind, value: u32) -> ArmVcpuResult
Writes one timer’s control register.
Sourcepub fn write_tval(
&mut self,
kind: ArmTimerKind,
physical_counter: u64,
value: u32,
) -> ArmVcpuResult
pub fn write_tval( &mut self, kind: ArmTimerKind, physical_counter: u64, value: u32, ) -> ArmVcpuResult
Writes one timer’s timer-value register.
Sourcepub fn write_compare(&mut self, kind: ArmTimerKind, value: u64) -> ArmVcpuResult
pub fn write_compare(&mut self, kind: ArmTimerKind, value: u64) -> ArmVcpuResult
Writes one timer’s compare-value register.
Sourcepub fn load(&mut self, registers: &mut impl ArmTimerRegisters) -> ArmVcpuResult
pub fn load(&mut self, registers: &mut impl ArmTimerRegisters) -> ArmVcpuResult
Loads the direct virtual timer into hardware.
Sourcepub fn put(&mut self, registers: &mut impl ArmTimerRegisters) -> ArmVcpuResult
pub fn put(&mut self, registers: &mut impl ArmTimerRegisters) -> ArmVcpuResult
Saves and stops the direct virtual timer before restoring the host epoch.
Sourcepub fn reset(&mut self) -> ArmVcpuResult
pub fn reset(&mut self) -> ArmVcpuResult
Resets both timer contexts.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ArmVcpuTimer
impl RefUnwindSafe for ArmVcpuTimer
impl Send for ArmVcpuTimer
impl Sync for ArmVcpuTimer
impl Unpin for ArmVcpuTimer
impl UnsafeUnpin for ArmVcpuTimer
impl UnwindSafe for ArmVcpuTimer
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
Mutably borrows from an owned value. Read more