This structure is shared with hardware in the AMD VMCB.

Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
---
CC: Jan Beulich <jbeul...@suse.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c 
b/xen/arch/x86/x86_emulate/x86_emulate.c
index 87e84c6..5805d70 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -7899,6 +7899,12 @@ static void __init __maybe_unused build_assertions(void)
     BUILD_BUG_ON(X86_EVENTTYPE_SW_INTERRUPT != 4);
     BUILD_BUG_ON(X86_EVENTTYPE_PRI_SW_EXCEPTION != 5);
     BUILD_BUG_ON(X86_EVENTTYPE_SW_EXCEPTION != 6);
+
+    /* Check struct segment_register against the VMCB segment layout. */
+    BUILD_BUG_ON(sizeof(struct segment_register) != 16);
+    BUILD_BUG_ON(offsetof(struct segment_register, attr) != 2);
+    BUILD_BUG_ON(offsetof(struct segment_register, limit) != 4);
+    BUILD_BUG_ON(offsetof(struct segment_register, base) != 8);
 }
 
 #ifndef NDEBUG
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to