thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 6 months ago
Clone

Blame SOURCES/kvm-target-i386-Declare-constants-for-XSAVE-offsets.patch

e2f3ee
From 2d657f560ad94d6a2459d6318d2d0a6847e6bba4 Mon Sep 17 00:00:00 2001
e2f3ee
From: David Edmondson <david.edmondson@oracle.com>
e2f3ee
Date: Mon, 5 Jul 2021 11:46:25 +0100
e2f3ee
Subject: [PATCH 1/7] target/i386: Declare constants for XSAVE offsets
e2f3ee
e2f3ee
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
e2f3ee
RH-MergeRequest: 113: non-av 8.5z: Fix XSAVE on newer CPUs
e2f3ee
RH-Commit: [1/7] 85ec92995a1f2488dea8f2c3b527b1b42f1ed882
e2f3ee
RH-Bugzilla: 2065239
e2f3ee
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
e2f3ee
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
e2f3ee
RH-Acked-by: Bandan Das <None>
e2f3ee
e2f3ee
Declare and use manifest constants for the XSAVE state component
e2f3ee
offsets.
e2f3ee
e2f3ee
Signed-off-by: David Edmondson <david.edmondson@oracle.com>
e2f3ee
Message-Id: <20210705104632.2902400-2-david.edmondson@oracle.com>
e2f3ee
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
e2f3ee
(cherry picked from commit ac7b7cae4e8598359a2a7557899904c9563a776a)
e2f3ee
(cherry picked from commit 2644e6189fdf2ae5f19b5ac8cc2939e0d4e4c92f)
e2f3ee
---
e2f3ee
 target/i386/cpu.h | 30 +++++++++++++++++++++++-------
e2f3ee
 1 file changed, 23 insertions(+), 7 deletions(-)
e2f3ee
e2f3ee
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
e2f3ee
index 7a3aa40201..1fac5170a6 100644
e2f3ee
--- a/target/i386/cpu.h
e2f3ee
+++ b/target/i386/cpu.h
e2f3ee
@@ -1272,6 +1272,22 @@ typedef struct XSavePKRU {
e2f3ee
     uint32_t padding;
e2f3ee
 } XSavePKRU;
e2f3ee
 
e2f3ee
+#define XSAVE_FCW_FSW_OFFSET    0x000
e2f3ee
+#define XSAVE_FTW_FOP_OFFSET    0x004
e2f3ee
+#define XSAVE_CWD_RIP_OFFSET    0x008
e2f3ee
+#define XSAVE_CWD_RDP_OFFSET    0x010
e2f3ee
+#define XSAVE_MXCSR_OFFSET      0x018
e2f3ee
+#define XSAVE_ST_SPACE_OFFSET   0x020
e2f3ee
+#define XSAVE_XMM_SPACE_OFFSET  0x0a0
e2f3ee
+#define XSAVE_XSTATE_BV_OFFSET  0x200
e2f3ee
+#define XSAVE_AVX_OFFSET        0x240
e2f3ee
+#define XSAVE_BNDREG_OFFSET     0x3c0
e2f3ee
+#define XSAVE_BNDCSR_OFFSET     0x400
e2f3ee
+#define XSAVE_OPMASK_OFFSET     0x440
e2f3ee
+#define XSAVE_ZMM_HI256_OFFSET  0x480
e2f3ee
+#define XSAVE_HI16_ZMM_OFFSET   0x680
e2f3ee
+#define XSAVE_PKRU_OFFSET       0xa80
e2f3ee
+
e2f3ee
 typedef struct X86XSaveArea {
e2f3ee
     X86LegacyXSaveArea legacy;
e2f3ee
     X86XSaveHeader header;
e2f3ee
@@ -1292,19 +1308,19 @@ typedef struct X86XSaveArea {
e2f3ee
     XSavePKRU pkru_state;
e2f3ee
 } X86XSaveArea;
e2f3ee
 
e2f3ee
-QEMU_BUILD_BUG_ON(offsetof(X86XSaveArea, avx_state) != 0x240);
e2f3ee
+QEMU_BUILD_BUG_ON(offsetof(X86XSaveArea, avx_state) != XSAVE_AVX_OFFSET);
e2f3ee
 QEMU_BUILD_BUG_ON(sizeof(XSaveAVX) != 0x100);
e2f3ee
-QEMU_BUILD_BUG_ON(offsetof(X86XSaveArea, bndreg_state) != 0x3c0);
e2f3ee
+QEMU_BUILD_BUG_ON(offsetof(X86XSaveArea, bndreg_state) != XSAVE_BNDREG_OFFSET);
e2f3ee
 QEMU_BUILD_BUG_ON(sizeof(XSaveBNDREG) != 0x40);
e2f3ee
-QEMU_BUILD_BUG_ON(offsetof(X86XSaveArea, bndcsr_state) != 0x400);
e2f3ee
+QEMU_BUILD_BUG_ON(offsetof(X86XSaveArea, bndcsr_state) != XSAVE_BNDCSR_OFFSET);
e2f3ee
 QEMU_BUILD_BUG_ON(sizeof(XSaveBNDCSR) != 0x40);
e2f3ee
-QEMU_BUILD_BUG_ON(offsetof(X86XSaveArea, opmask_state) != 0x440);
e2f3ee
+QEMU_BUILD_BUG_ON(offsetof(X86XSaveArea, opmask_state) != XSAVE_OPMASK_OFFSET);
e2f3ee
 QEMU_BUILD_BUG_ON(sizeof(XSaveOpmask) != 0x40);
e2f3ee
-QEMU_BUILD_BUG_ON(offsetof(X86XSaveArea, zmm_hi256_state) != 0x480);
e2f3ee
+QEMU_BUILD_BUG_ON(offsetof(X86XSaveArea, zmm_hi256_state) != XSAVE_ZMM_HI256_OFFSET);
e2f3ee
 QEMU_BUILD_BUG_ON(sizeof(XSaveZMM_Hi256) != 0x200);
e2f3ee
-QEMU_BUILD_BUG_ON(offsetof(X86XSaveArea, hi16_zmm_state) != 0x680);
e2f3ee
+QEMU_BUILD_BUG_ON(offsetof(X86XSaveArea, hi16_zmm_state) != XSAVE_HI16_ZMM_OFFSET);
e2f3ee
 QEMU_BUILD_BUG_ON(sizeof(XSaveHi16_ZMM) != 0x400);
e2f3ee
-QEMU_BUILD_BUG_ON(offsetof(X86XSaveArea, pkru_state) != 0xA80);
e2f3ee
+QEMU_BUILD_BUG_ON(offsetof(X86XSaveArea, pkru_state) != XSAVE_PKRU_OFFSET);
e2f3ee
 QEMU_BUILD_BUG_ON(sizeof(XSavePKRU) != 0x8);
e2f3ee
 
e2f3ee
 typedef enum TPRAccess {
e2f3ee
-- 
e2f3ee
2.27.0
e2f3ee