|
@@ -35,9 +35,6 @@ static unsigned int xstate_offsets[XFEATURE_MAX] = { [ 0 ... XFEATURE_MAX - 1] =
|
|
static unsigned int xstate_sizes[XFEATURE_MAX] = { [ 0 ... XFEATURE_MAX - 1] = -1};
|
|
static unsigned int xstate_sizes[XFEATURE_MAX] = { [ 0 ... XFEATURE_MAX - 1] = -1};
|
|
static unsigned int xstate_comp_offsets[sizeof(xfeatures_mask)*8];
|
|
static unsigned int xstate_comp_offsets[sizeof(xfeatures_mask)*8];
|
|
|
|
|
|
-/* The number of supported xfeatures in xfeatures_mask: */
|
|
|
|
-static unsigned int xfeatures_nr;
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* Clear all of the X86_FEATURE_* bits that are unavailable
|
|
* Clear all of the X86_FEATURE_* bits that are unavailable
|
|
* when the CPU has no XSAVE support.
|
|
* when the CPU has no XSAVE support.
|
|
@@ -190,23 +187,18 @@ void fpu__init_cpu_xstate(void)
|
|
/*
|
|
/*
|
|
* Record the offsets and sizes of various xstates contained
|
|
* Record the offsets and sizes of various xstates contained
|
|
* in the XSAVE state memory layout.
|
|
* in the XSAVE state memory layout.
|
|
- *
|
|
|
|
- * ( Note that certain features might be non-present, for them
|
|
|
|
- * we'll have 0 offset and 0 size. )
|
|
|
|
*/
|
|
*/
|
|
static void __init setup_xstate_features(void)
|
|
static void __init setup_xstate_features(void)
|
|
{
|
|
{
|
|
- u32 eax, ebx, ecx, edx, leaf;
|
|
|
|
-
|
|
|
|
- xfeatures_nr = fls64(xfeatures_mask);
|
|
|
|
|
|
+ u32 eax, ebx, ecx, edx, i;
|
|
|
|
|
|
- for (leaf = FIRST_EXTENDED_XFEATURE; leaf < xfeatures_nr; leaf++) {
|
|
|
|
- cpuid_count(XSTATE_CPUID, leaf, &eax, &ebx, &ecx, &edx);
|
|
|
|
|
|
+ for (i = FIRST_EXTENDED_XFEATURE; i < XFEATURE_MAX; i++) {
|
|
|
|
+ cpuid_count(XSTATE_CPUID, i, &eax, &ebx, &ecx, &edx);
|
|
|
|
|
|
- xstate_offsets[leaf] = ebx;
|
|
|
|
- xstate_sizes[leaf] = eax;
|
|
|
|
|
|
+ xstate_offsets[i] = ebx;
|
|
|
|
+ xstate_sizes[i] = eax;
|
|
|
|
|
|
- printk(KERN_INFO "x86/fpu: xstate_offset[%d]: %4d, xstate_sizes[%d]: %4d\n", leaf, ebx, leaf, eax);
|
|
|
|
|
|
+ printk(KERN_INFO "x86/fpu: xstate_offset[%d]: %4d, xstate_sizes[%d]: %4d\n", i, ebx, i, eax);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -252,7 +244,7 @@ static void __init setup_xstate_comp(void)
|
|
xstate_comp_offsets[1] = offsetof(struct fxregs_state, xmm_space);
|
|
xstate_comp_offsets[1] = offsetof(struct fxregs_state, xmm_space);
|
|
|
|
|
|
if (!cpu_has_xsaves) {
|
|
if (!cpu_has_xsaves) {
|
|
- for (i = FIRST_EXTENDED_XFEATURE; i < xfeatures_nr; i++) {
|
|
|
|
|
|
+ for (i = FIRST_EXTENDED_XFEATURE; i < XFEATURE_MAX; i++) {
|
|
if (test_bit(i, (unsigned long *)&xfeatures_mask)) {
|
|
if (test_bit(i, (unsigned long *)&xfeatures_mask)) {
|
|
xstate_comp_offsets[i] = xstate_offsets[i];
|
|
xstate_comp_offsets[i] = xstate_offsets[i];
|
|
xstate_comp_sizes[i] = xstate_sizes[i];
|
|
xstate_comp_sizes[i] = xstate_sizes[i];
|
|
@@ -264,7 +256,7 @@ static void __init setup_xstate_comp(void)
|
|
xstate_comp_offsets[FIRST_EXTENDED_XFEATURE] =
|
|
xstate_comp_offsets[FIRST_EXTENDED_XFEATURE] =
|
|
FXSAVE_SIZE + XSAVE_HDR_SIZE;
|
|
FXSAVE_SIZE + XSAVE_HDR_SIZE;
|
|
|
|
|
|
- for (i = FIRST_EXTENDED_XFEATURE; i < xfeatures_nr; i++) {
|
|
|
|
|
|
+ for (i = FIRST_EXTENDED_XFEATURE; i < XFEATURE_MAX; i++) {
|
|
if (test_bit(i, (unsigned long *)&xfeatures_mask))
|
|
if (test_bit(i, (unsigned long *)&xfeatures_mask))
|
|
xstate_comp_sizes[i] = xstate_sizes[i];
|
|
xstate_comp_sizes[i] = xstate_sizes[i];
|
|
else
|
|
else
|