summaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorDavid Edmondson2021-07-05 12:46:27 +0200
committerPaolo Bonzini2021-07-06 07:54:53 +0200
commitfde74821006472f40fee9a094e6da86cd39b5623 (patch)
tree861482c5ab5003e1765a41942dee298c1541ad29 /target
parenttarget/i386: Consolidate the X86XSaveArea offset checks (diff)
downloadqemu-fde74821006472f40fee9a094e6da86cd39b5623.tar.gz
qemu-fde74821006472f40fee9a094e6da86cd39b5623.tar.xz
qemu-fde74821006472f40fee9a094e6da86cd39b5623.zip
target/i386: Clarify the padding requirements of X86XSaveArea
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>
Diffstat (limited to 'target')
-rw-r--r--target/i386/cpu.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 6590ad6391..92f9ca264c 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -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;