Ticket #9220: 0001-Add-an-x86-64-compatible-_ExecuteCommand.patch

File 0001-Add-an-x86-64-compatible-_ExecuteCommand.patch, 1.7 KB (added by landonf, 11 years ago)
  • src/add-ons/input_server/filters/vmware_mouse/VMWareMouse.cpp

    From f4136a91e70b1c09e4f6f5cb74300c5def5ef4c2 Mon Sep 17 00:00:00 2001
    From: Landon Fuller <landonf@plausible.coop>
    Date: Tue, 27 Nov 2012 00:14:06 -0500
    Subject: [PATCH] Add an x86-64 compatible _ExecuteCommand()
    
    This implementation introduces the minimal changes necessary to support
    the existing VMWareTypes API on x86-64. If a more expansive set of guest
    additions are required, it may make sense to adopt a more genera
    approach akin to the one used here:
    	https://github.com/jcs/vmwh/blob/f177dd3cf/vmware.c#L49
    ---
     .../filters/vmware_mouse/VMWareMouse.cpp            | 21 +++++++++++++++++++++
     1 file changed, 21 insertions(+)
    
    diff --git a/src/add-ons/input_server/filters/vmware_mouse/VMWareMouse.cpp b/src/add-ons/input_server/filters/vmware_mouse/VMWareMouse.cpp
    index b6cfe40..44a70b6 100644
    a b VMWareMouseFilter::_ExecuteCommand(union packet_u &packet)  
    104104    packet.command.port = VMWARE_PORT_NUMBER;
    105105
    106106    int dummy;
     107#ifdef __x86_64__
     108    asm volatile (
     109            "pushq %%rbx;"
     110            "pushq %%rax;"
     111            "movl 12(%%rax), %%edx;"
     112            "movl 8(%%rax), %%ecx;"
     113            "movl 4(%%rax), %%ebx;"
     114            "movl (%%rax), %%eax;"
     115            "inl %%dx, %%eax;"
     116            "xchgq %%rax, (%%rsp);"
     117            "movl %%edx, 12(%%rax);"
     118            "movl %%ecx, 8(%%rax);"
     119            "movl %%ebx, 4(%%rax);"
     120            "popq %%rbx;"
     121            "movl %%ebx, (%%rax);"
     122            "popq %%rbx;"
     123        : "=a"(dummy)
     124        : "0"(&packet)
     125        : "rcx", "rdx", "memory");
     126#else
    107127    asm volatile (
    108128            "pushl %%ebx;"
    109129            "pushl %%eax;"
    VMWareMouseFilter::_ExecuteCommand(union packet_u &packet)  
    121141        : "=a"(dummy)
    122142        : "0"(&packet)
    123143        : "ecx", "edx", "memory");
     144#endif
    124145}
    125146
    126147