File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,6 @@ extern "C" {
13
13
fn xrstor ( p : * const u8 , hi : u32 , lo : u32 ) -> ( ) ;
14
14
#[ link_name = "llvm.x86.xsetbv" ]
15
15
fn xsetbv ( v : u32 , hi : u32 , lo : u32 ) -> ( ) ;
16
- #[ link_name = "llvm.x86.xgetbv" ]
17
- fn xgetbv ( x : u32 ) -> i64 ;
18
16
#[ link_name = "llvm.x86.xsaveopt" ]
19
17
fn xsaveopt ( p : * mut u8 , hi : u32 , lo : u32 ) -> ( ) ;
20
18
#[ link_name = "llvm.x86.xsavec" ]
@@ -75,7 +73,10 @@ pub unsafe fn _xsetbv(a: u32, val: u64) {
75
73
#[ target_feature( enable = "xsave" ) ]
76
74
#[ cfg_attr( test, assert_instr( xgetbv) ) ]
77
75
pub unsafe fn _xgetbv ( xcr_no : u32 ) -> u64 {
78
- xgetbv ( xcr_no) as u64
76
+ let eax: u32 ;
77
+ let edx: u32 ;
78
+ asm ! ( "xgetbv" : "={eax}" ( eax) , "={edx}" ( edx) : "{ecx}" ( xcr_no) ) ;
79
+ ( ( edx as u64 ) << 32 ) | ( eax as u64 )
79
80
}
80
81
81
82
/// Perform a full or partial save of the enabled processor states to memory at
You can’t perform that action at this time.
0 commit comments