mirror of
https://github.com/json-c/json-c.git
synced 2026-03-21 05:59:07 +08:00
Merge pull request #590 from Xyene/fix-cpuid-segfault
Fix segmentation fault in CPUID check
This commit is contained in:
@@ -26,19 +26,8 @@
|
||||
static void do_cpuid(int regs[], int h)
|
||||
{
|
||||
/* clang-format off */
|
||||
__asm__ __volatile__(
|
||||
#if defined __x86_64__
|
||||
"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])
|
||||
__asm__ __volatile__("cpuid"
|
||||
: "=a"(regs[0]), "=b"(regs[1]), "=c"(regs[2]), "=d"(regs[3])
|
||||
: "a"(h));
|
||||
/* clang-format on */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user