@@ -13,6 +13,45 @@ pub enum InterruptType {
1313 FIQ = sys:: hv_interrupt_type_t_HV_INTERRUPT_TYPE_FIQ,
1414}
1515
16+ /// Events that can trigger a guest exit to the VMM.
17+ #[ repr( u32 ) ]
18+ #[ derive( Debug , Copy , Clone , Eq , PartialEq ) ]
19+ pub enum ExitReason {
20+ /// Asynchronous exit requested explicitly by `hv_vcpus_exit` call.
21+ Canceled = sys:: hv_exit_reason_t_HV_EXIT_REASON_CANCELED,
22+ /// Synchronous exception to EL2 triggered by the guest.
23+ Exception = sys:: hv_exit_reason_t_HV_EXIT_REASON_EXCEPTION,
24+ /// ARM Generic VTimer became pending since the last hv_vcpu_run() call
25+ /// returned. The caller is expected to make the interrupt corresponding to
26+ /// the VTimer pending in the guest's interrupt controller.
27+ ///
28+ /// This exit automatically sets the VTimer mask.
29+ /// The VCPU will not exit with this status again until after the mask is cleared
30+ /// with hv_vcpu_set_vtimer_mask(), which should be called during a trap of
31+ /// the EOI for the guest's VTimer interrupt handler.
32+ VTimerActivated = sys:: hv_exit_reason_t_HV_EXIT_REASON_VTIMER_ACTIVATED,
33+ /// Unable to determine exit reason: this should not happen under normal operation.
34+ Unknown = sys:: hv_exit_reason_t_HV_EXIT_REASON_UNKNOWN,
35+ }
36+
37+ impl Default for ExitReason {
38+ fn default ( ) -> Self {
39+ ExitReason :: Unknown
40+ }
41+ }
42+
43+ impl From < sys:: hv_exit_reason_t > for ExitReason {
44+ fn from ( value : sys:: hv_exit_reason_t ) -> Self {
45+ match value {
46+ sys:: hv_exit_reason_t_HV_EXIT_REASON_CANCELED => ExitReason :: Canceled ,
47+ sys:: hv_exit_reason_t_HV_EXIT_REASON_EXCEPTION => ExitReason :: Exception ,
48+ sys:: hv_exit_reason_t_HV_EXIT_REASON_VTIMER_ACTIVATED => ExitReason :: VTimerActivated ,
49+ sys:: hv_exit_reason_t_HV_EXIT_REASON_UNKNOWN => ExitReason :: Unknown ,
50+ _ => ExitReason :: Unknown ,
51+ }
52+ }
53+ }
54+
1655/// Contains information about an exit from the vcpu to the host.
1756pub type VcpuExit = sys:: hv_vcpu_exit_t ;
1857
0 commit comments