From: VMware, Inc <> Date: Tue, 24 Aug 2010 18:37:05 +0000 (-0700) Subject: Changes in shared code that don't affect open-vm-tools functionality. X-Git-Tag: 2010.08.24-292196~23 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=78d7278d69d3adbc34ea914b06933bb2bebfb816;p=thirdparty%2Fopen-vm-tools.git Changes in shared code that don't affect open-vm-tools functionality. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/include/backdoor_def.h b/open-vm-tools/lib/include/backdoor_def.h index 44d316829..95b0d84d3 100644 --- a/open-vm-tools/lib/include/backdoor_def.h +++ b/open-vm-tools/lib/include/backdoor_def.h @@ -143,7 +143,9 @@ # define BDOOR_CMD_FAS_GET_PLATFORM_NAME 2 #define BDOOR_CMD_SENDPSHAREHINTS 66 #define BDOOR_CMD_ENABLE_USB_MOUSE 67 -#define BDOOR_CMD_MAX 68 +#define BDOOR_CMD_GET_VCPU_INFO 68 +# define BDOOR_CMD_VCPU_SLC64 0 +#define BDOOR_CMD_MAX 69 /* diff --git a/open-vm-tools/lib/include/hostinfo.h b/open-vm-tools/lib/include/hostinfo.h index f3b445e66..e2b65cdfd 100644 --- a/open-vm-tools/lib/include/hostinfo.h +++ b/open-vm-tools/lib/include/hostinfo.h @@ -70,6 +70,7 @@ extern Bool Hostinfo_OSIsWow64(void); DWORD Hostinfo_OpenProcessBits(void); #endif extern Bool Hostinfo_NestingSupported(void); +extern Bool Hostinfo_SLC64Supported(void); extern Bool Hostinfo_TouchBackDoor(void); extern Bool Hostinfo_TouchVirtualPC(void); extern Bool Hostinfo_TouchXen(void); diff --git a/open-vm-tools/lib/include/x86cpuid.h b/open-vm-tools/lib/include/x86cpuid.h index 423efc9d8..c8d10ed60 100644 --- a/open-vm-tools/lib/include/x86cpuid.h +++ b/open-vm-tools/lib/include/x86cpuid.h @@ -170,10 +170,12 @@ typedef enum { #define CPUID_AMD_VENDOR_STRING "AuthcAMDenti" #define CPUID_CYRIX_VENDOR_STRING "CyriteadxIns" #define CPUID_VIA_VENDOR_STRING "CentaulsaurH" + #define CPUID_HYPERV_HYPERVISOR_VENDOR_STRING "Microsoft Hv" #define CPUID_KVM_HYPERVISOR_VENDOR_STRING "KVMKVMKVM\0\0\0" #define CPUID_VMWARE_HYPERVISOR_VENDOR_STRING "VMwareVMware" #define CPUID_XEN_HYPERVISOR_VENDOR_STRING "XenVMMXenVMM" + #define CPUID_INTEL_VENDOR_STRING_FIXED "GenuineIntel" #define CPUID_AMD_VENDOR_STRING_FIXED "AuthenticAMD" #define CPUID_CYRIX_VENDOR_STRING_FIXED "CyrixInstead" diff --git a/open-vm-tools/lib/misc/hostinfoPosix.c b/open-vm-tools/lib/misc/hostinfoPosix.c index 0b05399ea..0936d1d96 100644 --- a/open-vm-tools/lib/misc/hostinfoPosix.c +++ b/open-vm-tools/lib/misc/hostinfoPosix.c @@ -1930,6 +1930,44 @@ Hostinfo_NestingSupported(void) } +/* + *---------------------------------------------------------------------- + * + * Hostinfo_SLC64Supported -- + * + * Access the backdoor with an SLC64 control query. This is used + * to determine if we are running inside a VM that supports SLC64. + * This function should only be called after determining that the + * backdoor is present with Hostinfo_TouchBackdoor(). + * + * Results: + * TRUE if the outer VM supports SLC64. + * FALSE otherwise. + * + * Side effects: + * Exception if not in a VM, so don't do that! + * + *---------------------------------------------------------------------- + */ + +Bool +Hostinfo_SLC64Supported(void) +{ +#if defined(__i386__) || defined(__x86_64__) + uint32 result; + __asm__ __volatile__( + "inl %%dx, %%eax" + : "=a" (result) + : "0" (BDOOR_MAGIC), + "c" (BDOOR_CMD_GET_VCPU_INFO), + "d" (BDOOR_PORT) + ); + return (result & (1 << BDOOR_CMD_VCPU_SLC64)) != 0; +#endif + return FALSE; +} + + /* *---------------------------------------------------------------------- *