Hangin10 wrote:
I've added a routine to the article that checks that the CPUID instruction is supported.
I am fairly confident that it is correct, but if someone could take a look and double check, I'd
appreciate it.
I believe this is the code in question:
Code:
; returns 1 if CPUID is supported, 0 otherwise (ZF is also set accordingly)
pushfd ; get
pop eax
mov ecx, eax ; save
xor eax, 0x200000 ; flip
push eax ; set
popfd
pushfd ; and test
pop eax
xor eax, ecx ; mask changed bits
shr eax, 21 ; move bit 21 to bit 0
and eax, 1 ; and mask others
push ecx
popfd ; restore original flags
ret
Forgive my ignorance. How is this called from C?
I don't see much reference to it in the forums or general googling, so I'm guessing that people just assume their CPU is CPUID capable.
Thank you.