I have one small program. It is supposed to determine the width of VMA (Virtual Memory Address). It works fine with gcc/mingw, but for now i need equivalent to work with msvc. Here is the code
#include <stdio.h>
int main(int argc, char *argv[])
{
unsigned long ret = 0x80000000;
__asm __volatile("cpuid\n" : "+a" (ret));
if (ret >= 0x80000008) {
ret = 0x80000008;
__asm __volatile("cpuid\n" : "+a" (ret));
printf("%lu", (ret >> 8) & 0xff);
} else {
return (1);
}
return (0);
}
Visual Studio 2008 prints:
.\main.c(7) : error C2400: inline assembler syntax error in 'opcode'; found '('
.\main.c(8) : error C2143: syntax error : missing ';' before ':'
.\main.c(11) : error C2400: inline assembler syntax error in 'opcode'; found '('
.\main.c(12) : error C2143: syntax error : missing ';' before ':'
Could someone give a hint how to port this code?
User contributions licensed under CC BY-SA 3.0