Re: [PATCH] test: Add XSAVE unit test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/31/2010 02:17 PM, Sheng Yang wrote:
Only test legal action so far, we can extend it later.

The legal actions are tested by guests, so it's more important for unit tests to check illegal (and potentially subversive) actions.

+
+void test_xsave()
+{
+	unsigned int cr4;
+	uint64_t supported_xcr0;
+	uint64_t test_bits;
+
+	supported_xcr0 = get_supported_xcr0();
+	printf("Supported XCR0 bits: 0x%x\n", supported_xcr0);
+
+	printf("Check minimal XSAVE required bits: ");
+	test_bits = XSTATE_FP | XSTATE_SSE | XSTATE_YMM;
+	pass_if((supported_xcr0&  test_bits) == test_bits);

This will fail on a cpu without YMM but with xsave.

+
+int main()
+{
+	int cpuid_has_xsave;
+
+	cpuid_has_xsave = check_xsave();
+	if (cpuid_has_xsave) {
+		printf("CPU has XSAVE feature\n");
+		test_xsave();
+	} else
+		printf("CPU don't has XSAVE feature\n");
+	return 0;

Should return 1 if any failure for autotest integration.

+}
+


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux