File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -37,21 +37,21 @@ pub fn mapped_kernel(item: ItemStruct) -> syn::Result<TokenStream> {
37
37
impl Default for #ident {
38
38
fn default ( ) -> Self {
39
39
// Read LSTAR register.
40
- let mut edx = 0u32 ;
41
- let mut eax = 0u32 ;
40
+ let mut rdx : usize ;
41
+ let mut rax : usize ;
42
42
43
43
unsafe {
44
44
core:: arch:: asm!(
45
45
"rdmsr" ,
46
46
in( "ecx" ) 0xc0000082u32 ,
47
- out( "edx " ) edx,
48
- out( "eax " ) eax ,
47
+ out( "rdx " ) rdx , // Use 64-bits version to suppress "mov edx, edx".
48
+ out( "rax " ) rax , // Same here.
49
49
options( pure, nomem, preserves_flags, nostack)
50
50
) ;
51
51
}
52
52
53
53
// Get base address of the kernel.
54
- let aslr = ( ( edx as usize ) << 32 | ( eax as usize ) ) - 0xffffffff822001c0 ;
54
+ let aslr = ( ( rdx << 32 ) | rax ) - 0xffffffff822001c0 ;
55
55
let base = aslr + 0xffffffff82200000 ;
56
56
57
57
Self ( base as * const u8 )
You can’t perform that action at this time.
0 commit comments