1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _ASM_X86_FPU_XCR_H 3 #define _ASM_X86_FPU_XCR_H 4 5 #define XCR_XFEATURE_ENABLED_MASK 0x00000000 6 7 static inline u64 xgetbv(u32 index) 8 { 9 u32 eax, edx; 10 11 asm volatile("xgetbv" : "=a" (eax), "=d" (edx) : "c" (index)); 12 return eax + ((u64)edx << 32); 13 } 14 15 static inline void xsetbv(u32 index, u64 value) 16 { 17 u32 eax = value; 18 u32 edx = value >> 32; 19 20 asm volatile("xsetbv" :: "a" (eax), "d" (edx), "c" (index)); 21 } 22 23 #endif /* _ASM_X86_FPU_XCR_H */ 24