使用了cpuid指令的程序要想通用的话:
1.判断SPU是否支持cpuid指令
方法:看eflags的第21位(ID位)能否被改变
BOOL __declspec(naked) IsCpuidValid()
{
__asm
{
pushfd
pop eax //eax = eflags
mov ebx, eax
xor eax, 00200000h //toggle bit 21, eflags.[ID]
push eax
popfd
pushfd
pop eax
cmp eax, ebx
jz NO_CPUID
mov eax, 1
ret
NO_CPUID:
xor eax, eax
ret
}
}
[培训]科锐逆向工程师培训第53期2025年7月8日开班!