]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Changes in shared code that don't affect open-vm-tools functionality.
authorVMware, Inc <>
Tue, 24 Aug 2010 18:37:05 +0000 (11:37 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Tue, 24 Aug 2010 18:37:05 +0000 (11:37 -0700)
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/include/backdoor_def.h
open-vm-tools/lib/include/hostinfo.h
open-vm-tools/lib/include/x86cpuid.h
open-vm-tools/lib/misc/hostinfoPosix.c

index 44d316829a64ce9b539026db9bc8e9da3bb9e2a2..95b0d84d31b7476ebdc5fe1fa5655b78c1771c97 100644 (file)
 #  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
 
 
 /* 
index f3b445e66a4c07da7215aaee91d78a131ea15815..e2b65cdfdd7b59dff0e1c19e6629a16bda205ef4 100644 (file)
@@ -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);
index 423efc9d85287f6859671b95d3df82ad0146f539..c8d10ed60e28cbbd53fc29d80008525b38eeb55e 100644 (file)
@@ -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"
index 0b05399eac50719d365c47d58600969961fe9c2c..0936d1d96d078087d4e70548b8eb3004a72c7d1d 100644 (file)
@@ -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;
+}
+
+
 /*
  *----------------------------------------------------------------------
  *