Porting from Linux 32 bit to 64 bit
i got this piece of code that will detect VMWare but this is for Linux 32 bit:
int vmInfo, vmVer;
asm("mov $0x564D5868, %eax"); /* magic number */
asm("movw $0x0A, %cx");
asm("movw $0x5658, %dx"); /* VMware I/O port */
asm("in %dx, %eax"); //(or outl %eax, %dx)
asm("mov %%ebx, %0": "=r"(vmInfo));
asm("movandq %%ecx, %0": "=r"(vmVer));
It works perfectly fine on Linux 32 bit and will generate a crash while implementing "in" command on a real machine.
I want to make it work on Linux 64 bit. It doesnt crash on 64 bit machine.
The only thing that i could that i came across was to replace eax with rax, ecx and rcx and ebx with rbx. i have tried that but it didn't work :embarasse
Can you help me making it work on Linux 64 bit machine....
|All times are GMT +5.5. The time now is 00:56.|