@@ -10,9 +10,11 @@ pub type InterruptVector = u8;
1010/// The API trait for virtual machine management functionalities.
1111#[ crate :: api_def]
1212pub trait VmmIf {
13- /// Get the ID of the current virtual machine.
13+ /// Get the ID of the virtual machine executing on the current physical CPU.
14+ /// It MAY differ from the ID of the virtual machine calling this function.
1415 fn current_vm_id ( ) -> VMId ;
15- /// Get the ID of the current virtual CPU.
16+ /// Get the ID of the virtual CPU executing on the current physical CPU.
17+ /// It MAY differ from the ID of the virtual CPU calling this function.
1618 fn current_vcpu_id ( ) -> VCpuId ;
1719 /// Get the number of virtual CPUs in a virtual machine.
1820 fn vcpu_num ( vm_id : VMId ) -> Option < usize > ;
@@ -26,12 +28,14 @@ pub trait VmmIf {
2628 fn notify_vcpu_timer_expired ( vm_id : VMId , vcpu_id : VCpuId ) ;
2729}
2830
29- /// Get the number of virtual CPUs in the current virtual machine.
31+ /// Get the number of virtual CPUs in the virtual machine executing on the
32+ /// current physical CPU.
3033pub fn current_vm_vcpu_num ( ) -> usize {
3134 vcpu_num ( current_vm_id ( ) ) . unwrap ( )
3235}
3336
34- /// Get the mask of active virtual CPUs in the current virtual machine.
37+ /// Get the mask of active virtual CPUs in the virtual machine executing on the
38+ /// current physical CPU.
3539pub fn current_vm_active_vcpus ( ) -> usize {
3640 active_vcpus ( current_vm_id ( ) ) . unwrap ( )
3741}
0 commit comments