【发布时间】:2021-06-12 14:21:52
【问题描述】:
我编写了以下内联程序集来尝试检查 ID 标志。我知道应该设置它,因为我可以使用 cpuid 指令,但是当我测试它时这个函数返回 0。
_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;
}
有谁知道我在这里做错了什么,你能帮帮我吗?
如果有帮助,我在没有位掩码的情况下得到的值是582。
【问题讨论】:
标签: c x86-64 inline-assembly cpuid