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 <mmlr@mlotz.ch>
This commit is contained in:
Landon Fuller 2012-11-27 00:14:06 -05:00 committed by Michael Lotz
parent 054ec8a776
commit 297feca8e5

View File

@ -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
}