@@ -32,11 +32,7 @@ fn get_cpu_id_result(
32
32
eax_in : u32 ,
33
33
ecx_in : u32 ,
34
34
) -> CpuIdResult {
35
-
36
- let mut actual = raw_cpuid:: native_cpuid:: cpuid_count (
37
- eax_in,
38
- ecx_in,
39
- ) ;
35
+ let mut actual = raw_cpuid:: native_cpuid:: cpuid_count ( eax_in, ecx_in) ;
40
36
41
37
match eax_in {
42
38
CPUID_NAME => cpuid_name ( vcpu, actual) ,
@@ -57,27 +53,25 @@ fn get_cpu_id_result(
57
53
EXTENDED_TOPOLOGY_ENUMERATION => {
58
54
todo ! ( "This basically requires APIC stuff to be done." )
59
55
}
60
- PROCESSOR_EXTENDED_STATE_ENUMERATION => {
61
- actual
62
- }
56
+ PROCESSOR_EXTENDED_STATE_ENUMERATION => actual,
63
57
// There are bunch more leaves after PROCESSOR_EXTENDED_STATE_ENUMERATION, however most of them seem unlikely to be used/ not relevant
64
58
V2_EXTENDED_TOPOLOGY_ENUMERATION => {
65
59
todo ! ( "Requires APIC" )
66
60
}
67
- 0x40000000 ..=0x4FFFFFFF => {
61
+ 0x40000000 ..=0x4FFFFFFF => {
68
62
// these are software reserved.
69
63
actual
70
64
}
71
- EXTENDED_FUNCTION_CPUID_INFORMATION => {
72
- CpuIdResult {
73
- eax : MAX_CPUID_INPUT ,
74
- ebx : 0 ,
75
- ecx : 0 ,
76
- edx : 0
77
- }
78
- }
65
+ EXTENDED_FUNCTION_CPUID_INFORMATION => CpuIdResult {
66
+ eax : MAX_CPUID_INPUT ,
67
+ ebx : 0 ,
68
+ ecx : 0 ,
69
+ edx : 0 ,
70
+ } ,
79
71
CPUID_BRAND_STRING_1 ..=CPUID_BRAND_STRING_3 => {
80
- if vcpu. vm . config . override_cpu_name ( ) { todo ! ( "CPU Brand string not implemented yet" ) }
72
+ if vcpu. vm . config . override_cpu_name ( ) {
73
+ todo ! ( "CPU Brand string not implemented yet" )
74
+ }
81
75
actual
82
76
}
83
77
_ => {
@@ -99,7 +93,7 @@ bitfield! {
99
93
max_addressable_ids_physical, set_max_addressable_ids_physical: 26 , 31 ;
100
94
}
101
95
102
- fn intel_cache_topo ( mut actual : CpuIdResult ) -> CpuIdResult {
96
+ fn intel_cache_topo ( actual : CpuIdResult ) -> CpuIdResult {
103
97
let mut cache_topo_eax = IntelCoreCacheTopologyEaxRes ( actual. eax ) ;
104
98
cache_topo_eax. set_max_addressable_ids_logical ( todo ! ( "waiting on apics" ) ) ;
105
99
cache_topo_eax. set_max_addressable_ids_physical ( todo ! ( "waiting on apics" ) ) ;
@@ -210,15 +204,13 @@ pub fn emulate_cpuid(
210
204
211
205
//todo move this into get_cpu_id_result
212
206
if guest_cpu. rax as u32 == 1 {
213
-
214
207
// Hide hypervisor feature
215
208
res. ecx &= !( 1 << 31 ) ;
216
209
217
210
// Hide TSC deadline timer
218
211
res. ecx &= !( 1 << 24 ) ;
219
212
}
220
213
221
-
222
214
guest_cpu. rax = res. eax as u64 | ( guest_cpu. rax & 0xffffffff00000000 ) ;
223
215
guest_cpu. rbx = res. ebx as u64 | ( guest_cpu. rbx & 0xffffffff00000000 ) ;
224
216
guest_cpu. rcx = res. ecx as u64 | ( guest_cpu. rcx & 0xffffffff00000000 ) ;
0 commit comments