Author: cem
Date: Fri Apr 17 15:19:42 2020
New Revision: 360044
URL: https://svnweb.freebsd.org/changeset/base/360044

Log:
  vmm.h: Add ABI assertions and mark implicit holes
  
  The static assertions were added (with size and offsets from gdb) and verified
  with a build prior to marking the holes explicitly.
  
  This is in preparation for a subsequent revision, pending in phabricator, that
  makes use of some of these unused bits without impacting the ABI.
  
  Reviewed by:  grehan
  Differential Revision:        https://reviews.freebsd.org/D24461

Modified:
  head/sys/amd64/include/vmm.h

Modified: head/sys/amd64/include/vmm.h
==============================================================================
--- head/sys/amd64/include/vmm.h        Fri Apr 17 14:57:15 2020        
(r360043)
+++ head/sys/amd64/include/vmm.h        Fri Apr 17 15:19:42 2020        
(r360044)
@@ -515,6 +515,8 @@ struct vie_op {
        uint8_t         op_type;        /* type of operation (e.g. MOV) */
        uint16_t        op_flags;
 };
+_Static_assert(sizeof(struct vie_op) == 4, "ABI");
+_Static_assert(_Alignof(struct vie_op) == 2, "ABI");
 
 #define        VIE_INST_SIZE   15
 struct vie {
@@ -539,13 +541,17 @@ struct vie {
                        rm:4;
 
        uint8_t         ss:2,                   /* SIB byte */
-                       index:4,
-                       base:4;
+                       _sparebits:2,
+                       index:4,                /* SIB byte */
+                       base:4;                 /* SIB byte */
 
        uint8_t         disp_bytes;
        uint8_t         imm_bytes;
 
        uint8_t         scale;
+
+       uint8_t         _sparebytes[3];
+
        int             base_register;          /* VM_REG_GUEST_xyz */
        int             index_register;         /* VM_REG_GUEST_xyz */
        int             segment_register;       /* VM_REG_GUEST_xyz */
@@ -555,8 +561,14 @@ struct vie {
 
        uint8_t         decoded;        /* set to 1 if successfully decoded */
 
+       uint8_t         _sparebyte;
+
        struct vie_op   op;                     /* opcode description */
 };
+_Static_assert(sizeof(struct vie) == 64, "ABI");
+_Static_assert(__offsetof(struct vie, disp_bytes) == 22, "ABI");
+_Static_assert(__offsetof(struct vie, scale) == 24, "ABI");
+_Static_assert(__offsetof(struct vie, base_register) == 28, "ABI");
 
 enum vm_exitcode {
        VM_EXITCODE_INOUT,
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to