[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/3] x86/emul: Introduce build time assertions for struct segment_register



This structure is shared with hardware in the AMD VMCB.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
---
 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@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.