Fix segmentation fault in CPUID check

This commit is contained in:
Tudor Brindus
2020-05-01 22:24:20 -04:00
parent 1059007024
commit 0e5bbcaa16

View File

@@ -26,19 +26,8 @@
static void do_cpuid(int regs[], int h) static void do_cpuid(int regs[], int h)
{ {
/* clang-format off */ /* clang-format off */
__asm__ __volatile__( __asm__ __volatile__("cpuid"
#if defined __x86_64__ : "=a"(regs[0]), "=b"(regs[1]), "=c"(regs[2]), "=d"(regs[3])
"pushq %%rbx;\n"
#else
"pushl %%ebx;\n"
#endif
"cpuid;\n"
#if defined __x86_64__
"popq %%rbx;\n"
#else
"popl %%ebx;\n"
#endif
: "=a"(regs[0]), [ebx] "=r"(regs[1]), "=c"(regs[2]), "=d"(regs[3])
: "a"(h)); : "a"(h));
/* clang-format on */ /* clang-format on */
} }