File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,7 +38,8 @@ use core::arch::asm;
3838use core:: mem;
3939use core:: mem:: MaybeUninit ;
4040use cpufeature:: backend:: CpuidBackend ;
41- use cpufeature:: leaves:: leaf_07:: CET_SS ;
41+ use cpufeature:: leaves:: CpuidFeature ;
42+ use cpufeature:: leaves:: CET_SS ;
4243use syscall:: GlobalFeatureFlags ;
4344
4445#[ cfg( debug_assertions) ]
@@ -61,7 +62,17 @@ impl NativePlatform {
6162 }
6263}
6364
64- impl CpuidBackend for NativePlatform { }
65+ impl CpuidBackend for NativePlatform {
66+ fn cpuid ( feature : & CpuidFeature ) -> Option < cpufeature:: backend:: CpuidResult > {
67+ let regs = CpuidResult :: get ( feature. leaf , feature. subleaf ) ;
68+ Some ( cpufeature:: backend:: CpuidResult {
69+ eax : regs. eax ,
70+ ebx : regs. ebx ,
71+ ecx : regs. ecx ,
72+ edx : regs. edx ,
73+ } )
74+ }
75+ }
6576
6677impl SvsmPlatform for NativePlatform {
6778 #[ cfg( test) ]
@@ -113,7 +124,7 @@ impl SvsmPlatform for NativePlatform {
113124 }
114125
115126 fn determine_cet_support ( & self ) -> bool {
116- Self :: cpuid_value ( & CET_SS ) != 0
127+ Self :: cpuid_value ( & CET_SS ) . is_some_and ( |v| v != 0 )
117128 }
118129
119130 fn capabilities ( & self ) -> Caps {
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ use core::ptr;
5959use core:: sync:: atomic:: { AtomicU32 , Ordering } ;
6060use cpufeature:: backend:: CpuidBackend ;
6161use cpufeature:: leaves:: CpuidFeature ;
62- use cpufeature:: leaves:: leaf_07 :: CET_SS ;
62+ use cpufeature:: leaves:: CET_SS ;
6363
6464static GHCB_IO_DRIVER : GHCBIOPort = GHCBIOPort :: new ( ) ;
6565
@@ -287,7 +287,7 @@ impl SvsmPlatform for SnpPlatform {
287287 }
288288
289289 fn determine_cet_support ( & self ) -> bool {
290- Self :: cpuid_value ( & CET_SS ) != 0
290+ Self :: cpuid_value ( & CET_SS ) . is_some_and ( |v| v != 0 )
291291 }
292292
293293 fn capabilities ( & self ) -> Caps {
You can’t perform that action at this time.
0 commit comments