【发布时间】:2010-12-28 03:43:46
【问题描述】:
谁能告诉我正确的 AT&T 语法来做我在 INTEL 下面做的事情 我已经展示了我在 AT&T 的尝试,但它们没有编译...
unsigned int CheckIfGenuineIntel(void)
{
unsigned int VendorIdentificationString[4] = {0, 0, 0, 0};
#if defined( _DO_INTEL_ )
__asm__ __volatile__
(
"xor eax, eax\n\t"
"cpuid\n\t"
"mov %0, ebx\n\t"
"mov %0 + 4, edx\n\t"
"mov %0 + 8, ecx"
:"=m"(VendorIdentificationString)
:
:"eax", "ebx", "ecx", "edx"
);
#else
asm volatile
(
"xor %%eax, %%eax\n\t"
"cpuid\n\t"
"movl %%ebx, %0\n\t"
"movl %%edx, 4(%0)\n\t"
"movl %%ecx, $8(%0)"
:"=m"(VendorIdentificationString)
:
:"eax", "ebx", "ecx", "edx"
);
#endif
printf("\nCheckIfGenuineIntel: '%s'\n", (char *)&VendorIdentificationString[0]);
return 1;
}
【问题讨论】:
-
请您修改一下格式好吗?
标签: gcc assembly x86 inline-assembly att