usr/src/uts/i86pc/os/cpuid.c
changeset 9000 7a9c5c9ed60d
parent 8990 67ae112ecc4f
child 9283 2ee48b3d20ef
--- a/usr/src/uts/i86pc/os/cpuid.c	Mon Mar 09 14:52:55 2009 -0400
+++ b/usr/src/uts/i86pc/os/cpuid.c	Mon Mar 09 15:20:14 2009 -0700
@@ -114,13 +114,9 @@
 
 uint_t enable486;
 /*
- * This is set if Solaris is booted in a fully virtualized mode:
- *	- as HVM guest under xVM
- *	- as guest under VMware
- * check_for_hvm() has the logic to detect these 2 cases.
- * This is not applicable if Solaris is booted as a para virtual guest.
+ * This is set to platform type Solaris is running on.
  */
-int platform_is_virt = 0;
+static int platform_type = HW_NATIVE;
 
 /*
  * monitor/mwait info.
@@ -429,12 +425,11 @@
 #if !defined(__xpv)
 
 static void
-check_for_hvm()
+determine_platform()
 {
 	struct cpuid_regs cp;
 	char *xen_str;
 	uint32_t xen_signature[4];
-	extern int xpv_is_hvm;
 
 	/*
 	 * In a fully virtualized domain, Xen's pseudo-cpuid function
@@ -449,13 +444,39 @@
 	xen_signature[2] = cp.cp_edx;
 	xen_signature[3] = 0;
 	xen_str = (char *)xen_signature;
-	if (strcmp("XenVMMXenVMM", xen_str) == 0 && cp.cp_eax <= 0x40000002)
-		xpv_is_hvm = 1;
-
-	/* could we be running under vmware hypervisor */
-	if (xpv_is_hvm || vmware_platform())
-		platform_is_virt = 1;
+	if (strcmp("XenVMMXenVMM", xen_str) == 0 && cp.cp_eax <= 0x40000002) {
+		platform_type = HW_XEN_HVM;
+	} else if (vmware_platform()) { /* running under vmware hypervisor? */
+		platform_type = HW_VMWARE;
+	}
+}
+
+int
+get_hwenv(void)
+{
+	return (platform_type);
 }
+
+int
+is_controldom(void)
+{
+	return (0);
+}
+
+#else
+
+int
+get_hwenv(void)
+{
+	return (HW_XEN_PV);
+}
+
+int
+is_controldom(void)
+{
+	return (DOMAIN_IS_INITDOMAIN(xen_info));
+}
+
 #endif	/* __xpv */
 
 uint_t
@@ -1200,7 +1221,7 @@
 
 pass1_done:
 #if !defined(__xpv)
-	check_for_hvm();
+	determine_platform();
 #endif
 	cpi->cpi_pass = 1;
 	return (feature);