首页 > 代码库 > gcc内嵌汇编

gcc内嵌汇编

dev c++使用gcc编译器,下面遇到必须C代码中嵌入汇编指令。

示例程序:

unsigned long veax=1,deax,debx,decx,dedx;
__asm__
(
"movl %4,%%eax\n"
"cpuid\n"
"movl %%eax,%0\n"
"movl %%ebx,%1\n"
"movl %%ecx,%2\n"
"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

gcc内嵌汇编