1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Porting from Linux 32 bit to 64 bit

Discussion in 'Assembly Language Programming (ALP) Forum' started by vikramaditya234, Dec 3, 2008.

  1. vikramaditya234

    vikramaditya234 New Member

    Dec 3, 2008
    Likes Received:
    Trophy Points:
    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....


Share This Page