Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22233

How to convert Intel Assembly C to AT&T C++

$
0
0

I trying to convert function "__cpuid" from С language to C++.I have a problem that the g++ compiler does not work with Intel assembler.

I'm trying to translate this code:

__asm    {        mov    esi, CPUInfo        mov    eax, InfoType        xor ecx, ecx        cpuid        mov    dword ptr[esi + 0], eax        mov    dword ptr[esi + 4], ebx        mov    dword ptr[esi + 8], ecx        mov    dword ptr[esi + 12], edx    }

I tried to do it using examples from the Internet, I got this code, but it doesn't work:

__asm    ("movl   %CPUInfo,%esi\n""movl   %InfoType,%eax\n""xorl   %ecx,%ecx\n""cpuid\n""movl   %eax,0(%esi)\n""movl   %ebx,4(%esi))\n""movl   %ecx,8(%esi)\n""movl   %edx,12(%esi)\n"             :"=r"(CPUInfo)    );

Viewing all articles
Browse latest Browse all 22233

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>