]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
target/i386: Clarify the padding requirements of X86XSaveArea
authorDavid Edmondson <david.edmondson@oracle.com>
Mon, 5 Jul 2021 10:46:27 +0000 (11:46 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 6 Jul 2021 05:54:53 +0000 (07:54 +0200)
Replace the hard-coded size of offsets or structure elements with
defined constants or sizeof().

Signed-off-by: David Edmondson <david.edmondson@oracle.com>
Message-Id: <20210705104632.2902400-4-david.edmondson@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/cpu.h

index 6590ad63915347ffc6d0315d35f844b52ec6eab3..92f9ca264ce7e184dadc9fece131f47e2dea6974 100644 (file)
@@ -1329,7 +1329,13 @@ typedef struct X86XSaveArea {
 
     /* AVX State: */
     XSaveAVX avx_state;
-    uint8_t padding[960 - 576 - sizeof(XSaveAVX)];
+
+    /* Ensure that XSaveBNDREG is properly aligned. */
+    uint8_t padding[XSAVE_BNDREG_OFFSET
+                    - sizeof(X86LegacyXSaveArea)
+                    - sizeof(X86XSaveHeader)
+                    - sizeof(XSaveAVX)];
+
     /* MPX State: */
     XSaveBNDREG bndreg_state;
     XSaveBNDCSR bndcsr_state;