Jacek Caban (@jacek) commented about dlls/ntdll/unix/system.c:
do_cpuid( 0x0000000d, 1, regs3 ); /* get XSAVE details */ if (regs3[0] & 2) xstate_compaction_enabled = TRUE;
xstate_supported_features_mask = 3;
if (features & CPU_FEATURE_AVX)
xstate_supported_features_mask |= (UINT64)1 << XSTATE_AVX;
do_cpuid( 0x0000000d, 0, regs3 ); /* get user xstate features */
xstate_supported_features_mask = ((ULONG64)regs3[3] << 32) | regs3[0];
__asm__ volatile
(
"xorl %%ecx,%%ecx\n\t"
"xgetbv\n\t"
"movl %%eax,%0\n\t"
"movl %%edx,%1\n\t"
: "=m"(regs3[0]), "=m"(regs3[1]) : : "eax", "ecx", "edx"
);
It would be nice to avoid inline assembly like that. I guess we can't use builtin `_xgetbv` for compatibility reasons, but I guess we could have its local implementation, similar to `do_cpuid`.