Dear Friends,
Thanks to Carlos Garcia and his publication, he provided this Assembler code (used to detect VMware virtual machine):
__asm
{
mov eax, 0x564D5868; ascii: VMXh
mov edx, 0x5658; ascii: VX(port)
in eax, dx; input from Port
cmp ebx, 0x564D5868; ascii: VMXh
setz ecx; if successful->flag = 0
mov vmflag, ecx
ret
}
I need to translate it to AT&T syntax, because Code::Blocks require it, and this is difficult to me. Would you please help correcting my try:
int RetInt1 ()
{
unsigned int vm_flag = 1;
try
{
asm volatile(
"movl $0x564d5868, %eax\n\t"
"cpuid\n\t"
"movl $0x5658, (%edx)\n\t"
"cpuid\n\t"
"in (%dx), %eax\n\t"
"cmp $0x564d5868, %ebx\n\t"
"setz %ecx\n\t"
"movl (%ecx), vm_flag\n\t"
);
if (vm_flag == 0)
{
asm ("movl $1, %eax\n\t");
}
else
{
asm ("movl $0, %eax\n\t");
}
}
catch (int e)
{
asm ("movl $0, %eax\n\t");
}
}
Thank you in advance.
Kind regards!!