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)
|
104 | 104 | packet.command.port = VMWARE_PORT_NUMBER; |
105 | 105 | |
106 | 106 | 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 |
107 | 127 | asm volatile ( |
108 | 128 | "pushl %%ebx;" |
109 | 129 | "pushl %%eax;" |
… |
… |
VMWareMouseFilter::_ExecuteCommand(union packet_u &packet)
|
121 | 141 | : "=a"(dummy) |
122 | 142 | : "0"(&packet) |
123 | 143 | : "ecx", "edx", "memory"); |
| 144 | #endif |
124 | 145 | } |
125 | 146 | |
126 | 147 | |