diff options
author | Wei Huang <wei.huang2@amd.com> | 2011-05-09 11:38:55 +0100 |
---|---|---|
committer | Wei Huang <wei.huang2@amd.com> | 2011-05-09 11:38:55 +0100 |
commit | 0217c28adbb1656e72ce68239eb6092fdc7cde0c (patch) | |
tree | 7ca88d8c8022cdcbeeae5c42a599fe1612400779 /xen/arch/x86/xstate.c | |
parent | 3eb0faa4f80653d56e0e74d68872f6d73de23937 (diff) | |
download | xen-0217c28adbb1656e72ce68239eb6092fdc7cde0c.tar.gz xen-0217c28adbb1656e72ce68239eb6092fdc7cde0c.tar.bz2 xen-0217c28adbb1656e72ce68239eb6092fdc7cde0c.zip |
x86/fpu: add mask parameter to xsave and xrstor
Xen currently sets mask bits of xsave() and xrstor() to all 1's. This
patch adds a mask option to xsave() and xrstor().
Signed-off-by: Wei Huang <wei.huang2@amd.com>
Diffstat (limited to 'xen/arch/x86/xstate.c')
-rw-r--r-- | xen/arch/x86/xstate.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c index e358fd7bbd..fdb80d37ab 100644 --- a/xen/arch/x86/xstate.c +++ b/xen/arch/x86/xstate.c @@ -51,32 +51,37 @@ inline uint64_t get_xcr0(void) return this_cpu(xcr0); } -void xsave(struct vcpu *v) +void xsave(struct vcpu *v, uint64_t mask) { struct xsave_struct *ptr = v->arch.xsave_area; + uint32_t hmask = mask >> 32; + uint32_t lmask = mask; if ( cpu_has_xsaveopt ) asm volatile ( ".byte " REX_PREFIX "0x0f,0xae,0x37" : - : "a" (-1), "d" (-1), "D"(ptr) + : "a" (lmask), "d" (hmask), "D"(ptr) : "memory" ); else asm volatile ( ".byte " REX_PREFIX "0x0f,0xae,0x27" : - : "a" (-1), "d" (-1), "D"(ptr) + : "a" (lmask), "d" (hmask), "D"(ptr) : "memory" ); } -void xrstor(struct vcpu *v) +void xrstor(struct vcpu *v, uint64_t mask) { + uint32_t hmask = mask >> 32; + uint32_t lmask = mask; + struct xsave_struct *ptr = v->arch.xsave_area; asm volatile ( ".byte " REX_PREFIX "0x0f,0xae,0x2f" : - : "m" (*ptr), "a" (-1), "d" (-1), "D"(ptr) ); + : "m" (*ptr), "a" (lmask), "d" (hmask), "D"(ptr) ); } bool_t xsave_enabled(const struct vcpu *v) |