Check wheter CPUID is supported

I am trying to verify if the CPUID instruction is supported by the processor. I have this function that sends an assembly code to the processor:

1
2
3
4
5
6
7
8
9
BOOL SupportCPUID() {
     try {
          asm (".intel_syntax noprefix\n\txor eax, eax\n\tcpuid\n.att_syntax\n");
                }
          catch(char *str) {
               return false;
          }
     return true;
}


It returns me a true value always. How do I check if this works on a processor without CPUID (even if they are less now)? Do you think it will work? Thanks!
Last edited on
Does this mean it is right or "no idea"? :D
Sorry, no idea.
But I think that you can't catch it, as it is not a c++ exception
http://www.intel.com/content/dam/www/public/us/en/documents/application-notes/processor-identification-cpuid-instruction-note.pdf (p13)
Execution of CPUID on a processor that does not support this instruction will result in an invalid opcode exception

I don't know how could you treat that fault.

Edit: fixed the link
Last edited on
Thanks for the link. Anyway, I suppose that I must find something that works with any processor.
Topic archived. No new replies allowed.