40 #ifdef V8_ATOMICOPS_INTERNALS_X86_GCC_H_
46 #define cpuid(a, b, c, d, inp) \
47 asm("mov %%ebx, %%edi\n" \
49 "xchg %%edi, %%ebx\n" \
50 : "=a" (a), "=D" (b), "=c" (c), "=d" (d) : "a" (inp))
51 #elif defined(__x86_64__)
52 #define cpuid(a, b, c, d, inp) \
53 asm("mov %%rbx, %%rdi\n" \
55 "xchg %%rdi, %%rbx\n" \
56 : "=a" (a), "=D" (b), "=c" (c), "=d" (d) : "a" (inp))
59 #if defined(cpuid) // initialize the struct only on x86
77 void AtomicOps_Internalx86CPUFeaturesInit() {
86 cpuid(eax, ebx, ecx, edx, 0);
94 cpuid(eax, ebx, ecx, edx, 1);
96 int family = (eax >> 8) & 0xf;
97 int model = (eax >> 4) & 0xf;
99 family += (eax >> 20) & 0xff;
100 model += ((eax >> 16) & 0xf) << 4;
108 if (strcmp(vendor,
"AuthenticAMD") == 0 &&
110 32 <= model && model <= 63) {
120 class AtomicOpsx86Initializer {
122 AtomicOpsx86Initializer() {
123 AtomicOps_Internalx86CPUFeaturesInit();
129 AtomicOpsx86Initializer g_initer;
135 #endif // ifdef V8_ATOMICOPS_INTERNALS_X86_GCC_H_
static void MemCopy(void *dest, const void *src, size_t size)
struct AtomicOps_x86CPUFeatureStruct AtomicOps_Internalx86CPUFeatures