diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-09-05 09:18:39 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-05 09:18:39 +0200 |
commit | accf0fa697eeb5ff4c2360edc4da5b10abac0b7b (patch) | |
tree | a57dc9aa4a6b83be8ac8b4528cf06db5621e62aa /include/asm-x86/xcr.h | |
parent | ebd60cd64f8ab1170102c3ab072eb73042b7a33d (diff) | |
parent | fe47784ba5cbb6b713c013e046859946789b45e4 (diff) | |
download | blackbird-op-linux-accf0fa697eeb5ff4c2360edc4da5b10abac0b7b.tar.gz blackbird-op-linux-accf0fa697eeb5ff4c2360edc4da5b10abac0b7b.zip |
Merge branch 'x86/xsave' into x86/core
Diffstat (limited to 'include/asm-x86/xcr.h')
-rw-r--r-- | include/asm-x86/xcr.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/include/asm-x86/xcr.h b/include/asm-x86/xcr.h new file mode 100644 index 000000000000..f2cba4e79a23 --- /dev/null +++ b/include/asm-x86/xcr.h @@ -0,0 +1,49 @@ +/* -*- linux-c -*- ------------------------------------------------------- * + * + * Copyright 2008 rPath, Inc. - All Rights Reserved + * + * This file is part of the Linux kernel, and is made available under + * the terms of the GNU General Public License version 2 or (at your + * option) any later version; incorporated herein by reference. + * + * ----------------------------------------------------------------------- */ + +/* + * asm-x86/xcr.h + * + * Definitions for the eXtended Control Register instructions + */ + +#ifndef _ASM_X86_XCR_H +#define _ASM_X86_XCR_H + +#define XCR_XFEATURE_ENABLED_MASK 0x00000000 + +#ifdef __KERNEL__ +# ifndef __ASSEMBLY__ + +#include <linux/types.h> + +static inline u64 xgetbv(u32 index) +{ + u32 eax, edx; + + asm volatile(".byte 0x0f,0x01,0xd0" /* xgetbv */ + : "=a" (eax), "=d" (edx) + : "c" (index)); + return eax + ((u64)edx << 32); +} + +static inline void xsetbv(u32 index, u64 value) +{ + u32 eax = value; + u32 edx = value >> 32; + + asm volatile(".byte 0x0f,0x01,0xd1" /* xsetbv */ + : : "a" (eax), "d" (edx), "c" (index)); +} + +# endif /* __ASSEMBLY__ */ +#endif /* __KERNEL__ */ + +#endif /* _ASM_X86_XCR_H */ |