This repository was archived by the owner on Nov 6, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -13,3 +13,4 @@ kvm-v4_14_0 = []
13
13
kvm-v4_20_0 = []
14
14
15
15
[dependencies ]
16
+ vmm-sys-util = " >=0.2.0"
Original file line number Diff line number Diff line change 5
5
#![ allow( non_camel_case_types) ]
6
6
#![ allow( non_snake_case) ]
7
7
8
+ #[ macro_use]
9
+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
10
+ extern crate vmm_sys_util;
11
+
8
12
#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
9
13
mod x86;
10
14
#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
Original file line number Diff line number Diff line change
1
+ // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ use vmm_sys_util:: fam:: { FamStruct , FamStructWrapper } ;
5
+
6
+ #[ cfg( feature = "kvm-v4_14_0" ) ]
7
+ use super :: bindings_v4_14_0:: * ;
8
+
9
+ #[ cfg( feature = "kvm-v4_20_0" ) ]
10
+ use super :: bindings_v4_20_0:: * ;
11
+
12
+ #[ cfg( all( not( feature = "kvm-v4_14_0" ) , not( feature = "kvm-v4_20_0" ) ) ) ]
13
+ use super :: bindings_v4_20_0:: * ;
14
+
15
+ /// Maximum number of CPUID entries that can be returned by a call to KVM ioctls.
16
+ ///
17
+ /// See arch/x86/include/asm/kvm_host.h
18
+ pub const KVM_MAX_CPUID_ENTRIES : usize = 80 ;
19
+
20
+ // Implement the FamStruct trait for kvm_cpuid2.
21
+ generate_fam_struct_impl ! (
22
+ kvm_cpuid2,
23
+ kvm_cpuid_entry2,
24
+ entries,
25
+ u32 ,
26
+ nent,
27
+ KVM_MAX_CPUID_ENTRIES
28
+ ) ;
29
+
30
+ /// Wrapper over the `kvm_cpuid2` structure.
31
+ ///
32
+ /// The `kvm_cpuid2` structure contains a flexible array member. For details check the
33
+ /// [KVM API](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt)
34
+ /// documentation on `kvm_cpuid2`. To provide safe access to
35
+ /// the array elements, this type is implemented using
36
+ /// [FamStructWrapper](../vmm_sys_util/fam/struct.FamStructWrapper.html).
37
+ pub type CpuId = FamStructWrapper < kvm_cpuid2 > ;
Original file line number Diff line number Diff line change 1
1
// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
// SPDX-License-Identifier: Apache-2.0
3
3
4
+ mod fam_wrappers;
5
+
4
6
#[ cfg( feature = "kvm-v4_14_0" ) ]
5
7
mod bindings_v4_14_0;
6
8
#[ cfg( feature = "kvm-v4_20_0" ) ]
@@ -21,4 +23,6 @@ pub mod bindings {
21
23
22
24
#[ cfg( all( not( feature = "kvm-v4_14_0" ) , not( feature = "kvm-v4_20_0" ) ) ) ]
23
25
pub use super :: bindings_v4_20_0:: * ;
26
+
27
+ pub use super :: fam_wrappers:: * ;
24
28
}
You can’t perform that action at this time.
0 commit comments