dev c++使用gcc编译器,下面遇到必须C代码中嵌入汇编指令。
示例程序(读取CPU的相关参数):
unsigned long veax=1,deax,debx,decx,dedx;
__asm__
(
"movl %4,%%eax
"
"cpuid
"
"movl %%eax,%0
"
"movl %%ebx,%1
"
"movl %%ecx,%2
"
"movl %%edx,%3"
:"=m"(deax),"=m"(debx),"=m"(decx),"=m"(dedx)
:"a"(veax)
:"ebx","ecx","edx","memory"
);
具体规则详见:http://wenku.baidu.com/link?url=rzgQlSCTW6jCSEMLVFTBPEbJEz_Wpv1e-fEw4d6GpEX9IwLT3cQAzxviPWI8siBZS8poGla68AhGNJ9IT5ZV7ccAvSC3qPDq-Y4jjXN9r9S
http://www.cnblogs.com/byeyear/p/4675049.html