xstate.c (2f2fcc40a961ed04f0e130803fbaa868c2899310) | xstate.c (ad3bc25a320742f42b3015115384f5aec69c7ce2) |
---|---|
1/* 2 * xsave/xrstor support. 3 * 4 * Author: Suresh Siddha <suresh.b.siddha@intel.com> 5 */ 6#include <linux/compat.h> 7#include <linux/cpu.h> 8#include <linux/mman.h> --- 430 unchanged lines hidden (view full) --- 439{ 440 u32 eax, ebx, ecx, edx; 441 442 /* 443 * Only XSAVES supports supervisor states and it uses compacted 444 * format. Checking a supervisor state's uncompacted offset is 445 * an error. 446 */ | 1/* 2 * xsave/xrstor support. 3 * 4 * Author: Suresh Siddha <suresh.b.siddha@intel.com> 5 */ 6#include <linux/compat.h> 7#include <linux/cpu.h> 8#include <linux/mman.h> --- 430 unchanged lines hidden (view full) --- 439{ 440 u32 eax, ebx, ecx, edx; 441 442 /* 443 * Only XSAVES supports supervisor states and it uses compacted 444 * format. Checking a supervisor state's uncompacted offset is 445 * an error. 446 */ |
447 if (XFEATURE_MASK_SUPERVISOR & BIT_ULL(xfeature_nr)) { | 447 if (XFEATURE_MASK_SUPERVISOR & (1 << xfeature_nr)) { |
448 WARN_ONCE(1, "No fixed offset for xstate %d\n", xfeature_nr); 449 return -1; 450 } 451 452 CHECK_XFEATURE(xfeature_nr); 453 cpuid_count(XSTATE_CPUID, xfeature_nr, &eax, &ebx, &ecx, &edx); 454 return ebx; 455} --- 347 unchanged lines hidden (view full) --- 803 if (boot_cpu_has(X86_FEATURE_XSAVE)) 804 xsetbv(XCR_XFEATURE_ENABLED_MASK, xfeatures_mask); 805} 806 807/* 808 * Given an xstate feature mask, calculate where in the xsave 809 * buffer the state is. Callers should ensure that the buffer 810 * is valid. | 448 WARN_ONCE(1, "No fixed offset for xstate %d\n", xfeature_nr); 449 return -1; 450 } 451 452 CHECK_XFEATURE(xfeature_nr); 453 cpuid_count(XSTATE_CPUID, xfeature_nr, &eax, &ebx, &ecx, &edx); 454 return ebx; 455} --- 347 unchanged lines hidden (view full) --- 803 if (boot_cpu_has(X86_FEATURE_XSAVE)) 804 xsetbv(XCR_XFEATURE_ENABLED_MASK, xfeatures_mask); 805} 806 807/* 808 * Given an xstate feature mask, calculate where in the xsave 809 * buffer the state is. Callers should ensure that the buffer 810 * is valid. |
811 * 812 * Note: does not work for compacted buffers. |
|
811 */ | 813 */ |
812void *__raw_xsave_addr(struct xregs_state *xsave, int xstate_feature_mask) | 814static void *__raw_xsave_addr(struct xregs_state *xsave, int xstate_feature_mask) |
813{ 814 int feature_nr = fls64(xstate_feature_mask) - 1; 815 816 if (!xfeature_enabled(feature_nr)) { 817 WARN_ON_FPU(1); 818 return NULL; 819 } 820 --- 425 unchanged lines hidden --- | 815{ 816 int feature_nr = fls64(xstate_feature_mask) - 1; 817 818 if (!xfeature_enabled(feature_nr)) { 819 WARN_ON_FPU(1); 820 return NULL; 821 } 822 --- 425 unchanged lines hidden --- |