// http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inlin
// http://stackoverflow.com/questions/6268745/invalid-instruction-suffix-for-push-when-assembling-with-gas
#include <stdint.h>

void
cpuid_array(uint32_t op, uint32_t reg[4])
{
  asm volatile(
    "pushq %%rbx      \n" /* save %ebx */
    "cpuid            \n"
    "movl %%ebx, %1   \n" /* save what cpuid just put in %ebx */
    "popq %%rbx       \n" /* restore the old %ebx */
    : "=a"(reg[0]), "=r"(reg[1]), "=c"(reg[2]), "=d"(reg[3])
    : "a"(op)
    : "cc");
}
