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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice