@@ -32,11 +32,7 @@ fn get_cpu_id_result(
3232 eax_in : u32 ,
3333 ecx_in : u32 ,
3434) -> 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) ;
4036
4137 match eax_in {
4238 CPUID_NAME => cpuid_name ( vcpu, actual) ,
@@ -57,27 +53,25 @@ fn get_cpu_id_result(
5753 EXTENDED_TOPOLOGY_ENUMERATION => {
5854 todo ! ( "This basically requires APIC stuff to be done." )
5955 }
60- PROCESSOR_EXTENDED_STATE_ENUMERATION => {
61- actual
62- }
56+ PROCESSOR_EXTENDED_STATE_ENUMERATION => actual,
6357 // There are bunch more leaves after PROCESSOR_EXTENDED_STATE_ENUMERATION, however most of them seem unlikely to be used/ not relevant
6458 V2_EXTENDED_TOPOLOGY_ENUMERATION => {
6559 todo ! ( "Requires APIC" )
6660 }
67- 0x40000000 ..=0x4FFFFFFF => {
61+ 0x40000000 ..=0x4FFFFFFF => {
6862 // these are software reserved.
6963 actual
7064 }
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+ } ,
7971 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+ }
8175 actual
8276 }
8377 _ => {
@@ -99,7 +93,7 @@ bitfield! {
9993 max_addressable_ids_physical, set_max_addressable_ids_physical: 26 , 31 ;
10094}
10195
102- fn intel_cache_topo ( mut actual : CpuIdResult ) -> CpuIdResult {
96+ fn intel_cache_topo ( actual : CpuIdResult ) -> CpuIdResult {
10397 let mut cache_topo_eax = IntelCoreCacheTopologyEaxRes ( actual. eax ) ;
10498 cache_topo_eax. set_max_addressable_ids_logical ( todo ! ( "waiting on apics" ) ) ;
10599 cache_topo_eax. set_max_addressable_ids_physical ( todo ! ( "waiting on apics" ) ) ;
@@ -210,15 +204,13 @@ pub fn emulate_cpuid(
210204
211205 //todo move this into get_cpu_id_result
212206 if guest_cpu. rax as u32 == 1 {
213-
214207 // Hide hypervisor feature
215208 res. ecx &= !( 1 << 31 ) ;
216209
217210 // Hide TSC deadline timer
218211 res. ecx &= !( 1 << 24 ) ;
219212 }
220213
221-
222214 guest_cpu. rax = res. eax as u64 | ( guest_cpu. rax & 0xffffffff00000000 ) ;
223215 guest_cpu. rbx = res. ebx as u64 | ( guest_cpu. rbx & 0xffffffff00000000 ) ;
224216 guest_cpu. rcx = res. ecx as u64 | ( guest_cpu. rcx & 0xffffffff00000000 ) ;
0 commit comments