I have written the following inline assembly to try check for the ID flag. I know that it should be set because I can use the cpuid instruction, however this function returns 0 when I test it.
_Bool /* Checks whether the cpu has the cpuid instruction available */
cpu_has_cpuid(void) {
uint64_t out;
asm ("pushfq\n\t"
"popq %[out]\n\t"
: [out] "=r" (out)
:: "memory");
return out & 0x200000;
}
Does anyone know what I did wrong here and can you help me?
If it helps, the value I get without the bitmask is 582.