First Support on Ginger and OMAP TI
[linux-ginger.git] / arch / x86 / include / asm / xcr.h
blobf2cba4e79a239f63b53ef41c11879498b546bacb
1 /* -*- linux-c -*- ------------------------------------------------------- *
3 * Copyright 2008 rPath, Inc. - All Rights Reserved
5 * This file is part of the Linux kernel, and is made available under
6 * the terms of the GNU General Public License version 2 or (at your
7 * option) any later version; incorporated herein by reference.
9 * ----------------------------------------------------------------------- */
12 * asm-x86/xcr.h
14 * Definitions for the eXtended Control Register instructions
17 #ifndef _ASM_X86_XCR_H
18 #define _ASM_X86_XCR_H
20 #define XCR_XFEATURE_ENABLED_MASK 0x00000000
22 #ifdef __KERNEL__
23 # ifndef __ASSEMBLY__
25 #include <linux/types.h>
27 static inline u64 xgetbv(u32 index)
29 u32 eax, edx;
31 asm volatile(".byte 0x0f,0x01,0xd0" /* xgetbv */
32 : "=a" (eax), "=d" (edx)
33 : "c" (index));
34 return eax + ((u64)edx << 32);
37 static inline void xsetbv(u32 index, u64 value)
39 u32 eax = value;
40 u32 edx = value >> 32;
42 asm volatile(".byte 0x0f,0x01,0xd1" /* xsetbv */
43 : : "a" (eax), "d" (edx), "c" (index));
46 # endif /* __ASSEMBLY__ */
47 #endif /* __KERNEL__ */
49 #endif /* _ASM_X86_XCR_H */