Browse Source

Fix segmentation fault in CPUID check

tags/json-c-0.15-20200726
Tudor Brindus 5 years ago
parent
commit
0e5bbcaa16
1 changed files with 2 additions and 13 deletions
  1. +2
    -13
      random_seed.c

+ 2
- 13
random_seed.c 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__(
#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)); : "a"(h));
/* clang-format on */ /* clang-format on */
} }


Loading…
Cancel
Save