All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Andreas Färber" <afaerber@suse.de>,
	qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Richard Henderson" <rth@twiddle.net>
Subject: [Qemu-devel] [PULL 02/15] target-i386: Use xsave structs for ext_save_area
Date: Mon, 23 May 2016 16:24:14 -0300	[thread overview]
Message-ID: <1464031467-20736-3-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1464031467-20736-1-git-send-email-ehabkost@redhat.com>

This doesn't introduce any change in the code, as the offsets and
struct sizes match what was present in the table. This can be
validated by the QEMU_BUILD_BUG_ON lines on target-i386/cpu.h,
which ensures the struct sizes and offsets match the existing
values in ext_save_area.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target-i386/cpu.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 05bf5ed..e9ef39b 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -474,25 +474,32 @@ static const X86RegisterInfo32 x86_reg_info_32[CPU_NB_REGS32] = {
 const ExtSaveArea x86_ext_save_areas[] = {
     [XSTATE_YMM_BIT] =
           { .feature = FEAT_1_ECX, .bits = CPUID_EXT_AVX,
-            .offset = 0x240, .size = 0x100 },
+            .offset = offsetof(X86XSaveArea, avx_state),
+            .size = sizeof(XSaveAVX) },
     [XSTATE_BNDREGS_BIT] =
           { .feature = FEAT_7_0_EBX, .bits = CPUID_7_0_EBX_MPX,
-            .offset = 0x3c0, .size = 0x40  },
+            .offset = offsetof(X86XSaveArea, bndreg_state),
+            .size = sizeof(XSaveBNDREG)  },
     [XSTATE_BNDCSR_BIT] =
           { .feature = FEAT_7_0_EBX, .bits = CPUID_7_0_EBX_MPX,
-            .offset = 0x400, .size = 0x40  },
+            .offset = offsetof(X86XSaveArea, bndcsr_state),
+            .size = sizeof(XSaveBNDCSR)  },
     [XSTATE_OPMASK_BIT] =
           { .feature = FEAT_7_0_EBX, .bits = CPUID_7_0_EBX_AVX512F,
-            .offset = 0x440, .size = 0x40 },
+            .offset = offsetof(X86XSaveArea, opmask_state),
+            .size = sizeof(XSaveOpmask) },
     [XSTATE_ZMM_Hi256_BIT] =
           { .feature = FEAT_7_0_EBX, .bits = CPUID_7_0_EBX_AVX512F,
-            .offset = 0x480, .size = 0x200 },
+            .offset = offsetof(X86XSaveArea, zmm_hi256_state),
+            .size = sizeof(XSaveZMM_Hi256) },
     [XSTATE_Hi16_ZMM_BIT] =
           { .feature = FEAT_7_0_EBX, .bits = CPUID_7_0_EBX_AVX512F,
-            .offset = 0x680, .size = 0x400 },
+            .offset = offsetof(X86XSaveArea, hi16_zmm_state),
+            .size = sizeof(XSaveHi16_ZMM) },
     [XSTATE_PKRU_BIT] =
           { .feature = FEAT_7_0_ECX, .bits = CPUID_7_0_ECX_PKU,
-            .offset = 0xA80, .size = 0x8 },
+            .offset = offsetof(X86XSaveArea, pkru_state),
+            .size = sizeof(XSavePKRU) },
 };
 
 const char *get_register_name_32(unsigned int reg)
-- 
2.5.5

  parent reply	other threads:[~2016-05-23 19:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23 19:24 [Qemu-devel] [PULL 00/15] X86 queue, 2016-05-23 Eduardo Habkost
2016-05-23 19:24 ` [Qemu-devel] [PULL 01/15] target-i386: Define structs for layout of xsave area Eduardo Habkost
2016-05-23 19:24 ` Eduardo Habkost [this message]
2016-05-23 19:24 ` [Qemu-devel] [PULL 03/15] target-i386: kvm: Use X86XSaveArea struct for xsave save/load Eduardo Habkost
2016-05-23 19:24 ` [Qemu-devel] [PULL 04/15] osdep: Move default qemu_hw_version() value to a macro Eduardo Habkost
2016-05-23 19:24 ` [Qemu-devel] [PULL 05/15] pc: Set CPU model-id on compat_props for pc <= 2.4 Eduardo Habkost
2016-05-23 19:24 ` [Qemu-devel] [PULL 06/15] target-i386: Set constant model_id for qemu63/qemu32/athlon Eduardo Habkost
2016-05-23 20:49   ` Andreas Färber
2016-05-23 22:49     ` Eduardo Habkost
2016-05-23 19:24 ` [Qemu-devel] [PULL 07/15] cpu: Eliminate cpudef_init(), cpudef_setup() Eduardo Habkost
2016-05-23 19:24 ` [Qemu-devel] [PULL 08/15] target-i386: Move TCG initialization check to tcg_x86_init() Eduardo Habkost
2016-05-23 19:24 ` [Qemu-devel] [PULL 09/15] target-i386: Move TCG initialization to realize time Eduardo Habkost
2016-05-23 19:24 ` [Qemu-devel] [PULL 10/15] target-i386: Call cpu_exec_init() on realize Eduardo Habkost
2016-05-23 19:24 ` [Qemu-devel] [PULL 11/15] target-i386: kvm: Allocate kvm_msrs struct once per VCPU Eduardo Habkost
2016-05-23 19:24 ` [Qemu-devel] [PULL 12/15] target-i386: kvm: Increase MSR_BUF_SIZE Eduardo Habkost
2016-05-23 19:24 ` [Qemu-devel] [PULL 13/15] target-i386: kvm: Simplify MSR array construction Eduardo Habkost
2016-05-23 19:24 ` [Qemu-devel] [PULL 14/15] target-i386: kvm: Simplify MSR setting functions Eduardo Habkost
2016-05-23 19:24 ` [Qemu-devel] [PULL 15/15] target-i386: kvm: Eliminate kvm_msr_entry_set() Eduardo Habkost
2016-05-23 22:50 ` [Qemu-devel] [PULL 00/15] X86 queue, 2016-05-23 Eduardo Habkost
2016-05-24 13:10   ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464031467-20736-3-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=afaerber@suse.de \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.