[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 08/21] target-i386: xsave: Add FP and SSE bits to x86
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL 08/21] target-i386: xsave: Add FP and SSE bits to x86_ext_save_areas |
Date: |
Mon, 17 Oct 2016 15:51:25 -0200 |
Instead of treating the FP and SSE bits as special cases, add
them to the x86_ext_save_areas array. This will simplify the code
that calculates the supported xsave components and the size of
the xsave area.
Signed-off-by: Eduardo Habkost <address@hidden>
---
target-i386/cpu.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index b9ef34e..61240dd 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -535,6 +535,20 @@ typedef struct ExtSaveArea {
} ExtSaveArea;
static const ExtSaveArea x86_ext_save_areas[] = {
+ [XSTATE_FP_BIT] = {
+ /* x87 FP state component is always enabled if XSAVE is supported */
+ .feature = FEAT_1_ECX, .bits = CPUID_EXT_XSAVE,
+ /* x87 state is in the legacy region of the XSAVE area */
+ .offset = 0,
+ .size = sizeof(X86LegacyXSaveArea) + sizeof(X86XSaveHeader),
+ },
+ [XSTATE_SSE_BIT] = {
+ /* SSE state component is always enabled if XSAVE is supported */
+ .feature = FEAT_1_ECX, .bits = CPUID_EXT_XSAVE,
+ /* SSE state is in the legacy region of the XSAVE area */
+ .offset = 0,
+ .size = sizeof(X86LegacyXSaveArea) + sizeof(X86XSaveHeader),
+ },
[XSTATE_YMM_BIT] =
{ .feature = FEAT_1_ECX, .bits = CPUID_EXT_AVX,
.offset = offsetof(X86XSaveArea, avx_state),
@@ -568,9 +582,9 @@ static const ExtSaveArea x86_ext_save_areas[] = {
static uint32_t xsave_area_size(uint64_t mask)
{
int i;
- uint64_t ret = sizeof(X86LegacyXSaveArea) + sizeof(X86XSaveHeader);
+ uint64_t ret = 0;
- for (i = 2; i < ARRAY_SIZE(x86_ext_save_areas); i++) {
+ for (i = 0; i < ARRAY_SIZE(x86_ext_save_areas); i++) {
const ExtSaveArea *esa = &x86_ext_save_areas[i];
if ((mask >> i) & 1) {
ret = MAX(ret, esa->offset + esa->size);
@@ -2961,8 +2975,8 @@ static void x86_cpu_enable_xsave_components(X86CPU *cpu)
return;
}
- mask = (XSTATE_FP_MASK | XSTATE_SSE_MASK);
- for (i = 2; i < ARRAY_SIZE(x86_ext_save_areas); i++) {
+ mask = 0;
+ for (i = 0; i < ARRAY_SIZE(x86_ext_save_areas); i++) {
const ExtSaveArea *esa = &x86_ext_save_areas[i];
if (env->features[esa->feature] & esa->bits) {
mask |= (1ULL << i);
--
2.7.4
- [Qemu-devel] [PULL 00/21] x86 queue, 2016-10-17, Eduardo Habkost, 2016/10/17
- [Qemu-devel] [PULL 01/21] tests: Add test case for x86 feature parsing compatibility, Eduardo Habkost, 2016/10/17
- [Qemu-devel] [PULL 02/21] target-i386: List CPU models using subclass list, Eduardo Habkost, 2016/10/17
- [Qemu-devel] [PULL 03/21] target-i386: Disable VME by default with TCG, Eduardo Habkost, 2016/10/17
- [Qemu-devel] [PULL 04/21] target-i386: Register aliases for feature names with underscores, Eduardo Habkost, 2016/10/17
- [Qemu-devel] [PULL 06/21] target-i386: Remove underscores from feat_names arrays, Eduardo Habkost, 2016/10/17
- [Qemu-devel] [PULL 07/21] target-i386: Register properties for feature aliases manually, Eduardo Habkost, 2016/10/17
- [Qemu-devel] [PULL 05/21] target-i386: Make plus_features/minus_features QOM-based, Eduardo Habkost, 2016/10/17
- [Qemu-devel] [PULL 08/21] target-i386: xsave: Add FP and SSE bits to x86_ext_save_areas,
Eduardo Habkost <=
- [Qemu-devel] [PULL 09/21] qmp: Add runnability information to query-cpu-definitions, Eduardo Habkost, 2016/10/17
- [Qemu-devel] [PULL 11/21] apic: add global apic_get_class(), Eduardo Habkost, 2016/10/17
- [Qemu-devel] [PULL 10/21] target-i386: Move warning code outside x86_cpu_filter_features(), Eduardo Habkost, 2016/10/17
- [Qemu-devel] [PULL 12/21] apic: add send_msi() to APICCommonClass, Eduardo Habkost, 2016/10/17
- [Qemu-devel] [PULL 13/21] intel_iommu: pass whole remapped addresses to apic, Eduardo Habkost, 2016/10/17
- [Qemu-devel] [PULL 14/21] intel_iommu: redo configuraton check in realize, Eduardo Habkost, 2016/10/17
- [Qemu-devel] [PULL 15/21] intel_iommu: add OnOffAuto intr_eim as "eim" property, Eduardo Habkost, 2016/10/17
- [Qemu-devel] [PULL 16/21] intel_iommu: reject broken EIM, Eduardo Habkost, 2016/10/17
- [Qemu-devel] [PULL 18/21] target-i386: Unset cannot_destroy_with_object_finalize_yet, Eduardo Habkost, 2016/10/17
- [Qemu-devel] [PULL 19/21] target-i386: x86_cpu_load_features() function, Eduardo Habkost, 2016/10/17