mov [rsp+08],rbx
mov [rsp+10],rdi
push rbp
mov rbp,rsp
sub rsp,50
xorps xmm0,xmm0
xor eax,eax
movups [rbp-30],xmm0
mov [rbp-10],rax
movups [rbp-20],xmm0
mov r10d,cr8
mov eax,0000000F
mov cr8,eax
mov [rbp-18],0
xor ebx,ebx
mov r11,[rbp-18]
lea r9d,[rax+55]
mov edi,r9d
reload:
rdtsc
shl rdx,20
or rax,rdx
mov r8,rax
xor ecx,ecx
mov eax,00000001
cpuid
mov [rbp-30],eax
mov [rbp-2C],ebx
mov [rbp-28],ecx
mov [rbp-24],edx
rdtsc
shl rdx,20
or rax,rdx
sub rax,r8
add r11,rax
sub rdi,01
jne reload
mov rbx,[rbp-10]
mov [rbp-18],r11
reload2:
rdtsc
shl rdx,20
or rax,rdx
mov rcx,rax
rdtsc
shl rdx,20
or rax,rdx
sub rax,rcx
add rbx,rax
sub r9,01
jne reload2
mov [rbp-10],rbx
movzx eax,r10l
mov cr8,eax
处理方法:拦截rdtsc减去vmexit周期,减少误差。
检测三:
mov ecx,00000122
rdmsr
shl rdx,20
or rax,rdx
not al
and al,01
jmp FFFFF809FF716D52
mov al,01
ret
sub rsp,18
mov qword ptr [rsp],00000000
mov ecx,40000001
rdmsr
shl rdx,20
or rax,rdx
mov [rsp],rax
jmp FFFFF809FF75E03C
mov rax,[rsp]
add rsp,18
ret