39 #ifdef V8_ATOMICOPS_INTERNALS_X86_GCC_H_
45 #define cpuid(a, b, c, d, inp) \
46 asm("mov %%ebx, %%edi\n" \
48 "xchg %%edi, %%ebx\n" \
49 : "=a" (a), "=D" (b), "=c" (c), "=d" (d) : "a" (inp))
50 #elif defined(__x86_64__)
51 #define cpuid(a, b, c, d, inp) \
52 asm("mov %%rbx, %%rdi\n" \
54 "xchg %%rdi, %%rbx\n" \
55 : "=a" (a), "=D" (b), "=c" (c), "=d" (d) : "a" (inp))
58 #if defined(cpuid) // initialize the struct only on x86
76 void AtomicOps_Internalx86CPUFeaturesInit() {
85 cpuid(eax, ebx, ecx, edx, 0);
87 memcpy(vendor, &ebx, 4);
88 memcpy(vendor + 4, &edx, 4);
89 memcpy(vendor + 8, &ecx, 4);
93 cpuid(eax, ebx, ecx, edx, 1);
95 int family = (eax >> 8) & 0xf;
96 int model = (eax >> 4) & 0xf;
98 family += (eax >> 20) & 0xff;
99 model += ((eax >> 16) & 0xf) << 4;
107 if (strcmp(vendor,
"AuthenticAMD") == 0 &&
109 32 <= model && model <= 63) {
119 class AtomicOpsx86Initializer {
121 AtomicOpsx86Initializer() {
122 AtomicOps_Internalx86CPUFeaturesInit();
127 AtomicOpsx86Initializer g_initer;
133 #endif // ifdef V8_ATOMICOPS_INTERNALS_X86_GCC_H_
struct AtomicOps_x86CPUFeatureStruct AtomicOps_Internalx86CPUFeatures