Advertisement
Guest User

isCpuidAvailable function

a guest
Oct 3rd, 2018
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. global _isCpuidAvailable
  2.  
  3. segment .text align=16
  4.  
  5. _isCpuidAvailable:
  6. pushf
  7. pop eax
  8.  
  9. mov edx, eax
  10. xor edx, 0x200000 ; Try to change the 21th bit (ID bit)
  11.  
  12. push edx
  13. popf
  14. pushf
  15. pop eax
  16. push ecx
  17. popf
  18.  
  19. cmp ecx, eax
  20. setne al ; If we can change the ID bit, that means cpuid is available
  21. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement