From 297feca8e5e63ea20ade5cba97d485bb83cc95b9 Mon Sep 17 00:00:00 2001 From: Landon Fuller 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 general approach akin to the one used here: https://github.com/jcs/vmwh/blob/f177dd3cf/vmware.c#L49 Signed-off-by: Michael Lotz --- .../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 b6cfe4077e..44a70b6aaf 100644 --- a/src/add-ons/input_server/filters/vmware_mouse/VMWareMouse.cpp +++ b/src/add-ons/input_server/filters/vmware_mouse/VMWareMouse.cpp @@ -104,6 +104,26 @@ VMWareMouseFilter::_ExecuteCommand(union packet_u &packet) packet.command.port = VMWARE_PORT_NUMBER; int dummy; +#ifdef __x86_64__ + asm volatile ( + "pushq %%rbx;" + "pushq %%rax;" + "movl 12(%%rax), %%edx;" + "movl 8(%%rax), %%ecx;" + "movl 4(%%rax), %%ebx;" + "movl (%%rax), %%eax;" + "inl %%dx, %%eax;" + "xchgq %%rax, (%%rsp);" + "movl %%edx, 12(%%rax);" + "movl %%ecx, 8(%%rax);" + "movl %%ebx, 4(%%rax);" + "popq %%rbx;" + "movl %%ebx, (%%rax);" + "popq %%rbx;" + : "=a"(dummy) + : "0"(&packet) + : "rcx", "rdx", "memory"); +#else asm volatile ( "pushl %%ebx;" "pushl %%eax;" @@ -121,6 +141,7 @@ VMWareMouseFilter::_ExecuteCommand(union packet_u &packet) : "=a"(dummy) : "0"(&packet) : "ecx", "edx", "memory"); +#endif }