diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2015-11-19 16:52:33 -0200 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2016-05-23 13:19:36 -0300 |
commit | b503717d28e8f7eff39bf38624e6cf42687d951a (patch) | |
tree | 60fe87bc28f47f42e932f4cd87cf02f84fdf6fe6 /target-i386/kvm.c | |
parent | c9158547617584bb9d19db7fb139998fbef80133 (diff) |
target-i386: Define structs for layout of xsave area
Add structs that define the layout of the xsave areas used by
Intel processors. Add some QEMU_BUILD_BUG_ON lines to ensure the
structs match the XSAVE_* macros in target-i386/kvm.c and the
offsets and sizes at target-i386/cpu.c:ext_save_areas.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'target-i386/kvm.c')
-rw-r--r-- | target-i386/kvm.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/target-i386/kvm.c b/target-i386/kvm.c index c76e7bbc89..6937016570 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -1307,6 +1307,29 @@ static int kvm_put_fpu(X86CPU *cpu) #define XSAVE_Hi16_ZMM 416 #define XSAVE_PKRU 672 +#define XSAVE_BYTE_OFFSET(word_offset) \ + ((word_offset) * sizeof(((struct kvm_xsave *)0)->region[0])) + +#define ASSERT_OFFSET(word_offset, field) \ + QEMU_BUILD_BUG_ON(XSAVE_BYTE_OFFSET(word_offset) != \ + offsetof(X86XSaveArea, field)) + +ASSERT_OFFSET(XSAVE_FCW_FSW, legacy.fcw); +ASSERT_OFFSET(XSAVE_FTW_FOP, legacy.ftw); +ASSERT_OFFSET(XSAVE_CWD_RIP, legacy.fpip); +ASSERT_OFFSET(XSAVE_CWD_RDP, legacy.fpdp); +ASSERT_OFFSET(XSAVE_MXCSR, legacy.mxcsr); +ASSERT_OFFSET(XSAVE_ST_SPACE, legacy.fpregs); +ASSERT_OFFSET(XSAVE_XMM_SPACE, legacy.xmm_regs); +ASSERT_OFFSET(XSAVE_XSTATE_BV, header.xstate_bv); +ASSERT_OFFSET(XSAVE_YMMH_SPACE, avx_state); +ASSERT_OFFSET(XSAVE_BNDREGS, bndreg_state); +ASSERT_OFFSET(XSAVE_BNDCSR, bndcsr_state); +ASSERT_OFFSET(XSAVE_OPMASK, opmask_state); +ASSERT_OFFSET(XSAVE_ZMM_Hi256, zmm_hi256_state); +ASSERT_OFFSET(XSAVE_Hi16_ZMM, hi16_zmm_state); +ASSERT_OFFSET(XSAVE_PKRU, pkru_state); + static int kvm_put_xsave(X86CPU *cpu) { CPUX86State *env = &cpu->env; |