tech-kern archive

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

Re: [PATCH v3 1/2] Fetch XSAVE area component offsets and sizes when initializing x86 CPU



Le 07/06/2019 à 20:33, Michał Górny a écrit :
+#define XSAVE_MAX_COMPONENT XSAVE_Hi16_ZMM
[...]
+size_t x86_xsave_offsets[XSAVE_MAX_COMPONENT] __read_mostly;
+size_t x86_xsave_sizes[XSAVE_MAX_COMPONENT] __read_mostly;

Need +1, but see below

+	/* Get component offsets and sizes for the save area */
+	for (i = XSAVE_YMM_Hi128; i < __arraycount(x86_xsave_offsets); i++) {
+		if (x86_xsave_features & ((uint64_t)1 << i)) {

I would use __BIT(i).

In fact, the whole loop seems wrong: CPUID uses the XCR0_ constants, not the
XSAVE_ constants. Eg HDC is 13 in XCR0_ but 10 in XSAVE_, so you never iterate
over it.

I would drop XSAVE_* entirely and just use XCR0_*, it is forward compatible.

-#define	__NetBSD_Version__	899004200	/* NetBSD 8.99.42 */
+#define	__NetBSD_Version__	899004300	/* NetBSD 8.99.43 */

No version bump needed for that


Home | Main Index | Thread Index | Old Index