]> xenbits.xensource.com Git - xen.git/commitdiff
x86/emul: Use explicit __attribute__((__packed__)) rather than __packed
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 25 Oct 2016 17:46:39 +0000 (18:46 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 26 Oct 2016 13:03:52 +0000 (14:03 +0100)
x86_emulate.h is included by the userspace test harness.  Avoid using
constructs which don't come from standard header files.

Reposition the test harnesses inclusion of x86_emulate.h to avoid relying on
any definitions intended for use by x86_emulate.c alone.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
tools/tests/x86_emulator/test_x86_emulator.c
tools/tests/x86_emulator/x86_emulate.c
xen/arch/x86/x86_emulate/x86_emulate.h

index 15d100ab6d7ac29e56b331bc886551b16471a245..6f6d70f66d129b32706dd6d9c036c54185f9b586 100644 (file)
@@ -8,8 +8,6 @@
 #include <xen/xen.h>
 #include <sys/mman.h>
 
-#define __packed __attribute__((packed))
-
 #include "x86_emulate/x86_emulate.h"
 #include "blowfish.h"
 
index 50a4262e612423944ec832ed51dd28e11fedda9d..af90b6e56d504b7a77517e05cc070b9540c0e48a 100644 (file)
@@ -6,6 +6,8 @@
 #include <string.h>
 #include <xen/xen.h>
 
+#include "x86_emulate/x86_emulate.h"
+
 typedef bool bool_t;
 
 #define is_canonical_address(x) (((int64_t)(x) >> 47) == ((int64_t)(x) >> 63))
@@ -23,8 +25,6 @@ typedef bool bool_t;
 #define cpu_has_amd_erratum(nr) 0
 #define mark_regs_dirty(r) ((void)(r))
 
-#define __packed __attribute__((packed))
-
 /* For generic assembly code: use macros to define operation/operand sizes. */
 #ifdef __i386__
 # define __OS          "l"  /* Operation Suffix */
@@ -34,8 +34,6 @@ typedef bool bool_t;
 # define __OP          "r"  /* Operand Prefix */
 #endif
 
-#include "x86_emulate/x86_emulate.h"
-
 #define get_stub(stb) ((void *)((stb).addr = (uintptr_t)(stb).buf))
 #define put_stub(stb)
 
index 641711e87dc703859e49206f1e50d77a7f11de8b..c1a5a4836b0a865cfa00616ce24297b6c7215a62 100644 (file)
@@ -71,7 +71,7 @@ enum x86_swint_emulation {
  * Attribute for segment selector. This is a copy of bit 40:47 & 52:55 of the
  * segment descriptor. It happens to match the format of an AMD SVM VMCB.
  */
-typedef union __packed segment_attributes {
+typedef union __attribute__((__packed__)) segment_attributes {
     uint16_t bytes;
     struct
     {
@@ -91,7 +91,7 @@ typedef union __packed segment_attributes {
  * Full state of a segment register (visible and hidden portions).
  * Again, this happens to match the format of an AMD SVM VMCB.
  */
-struct __packed segment_register {
+struct __attribute__((__packed__)) segment_register {
     uint16_t   sel;
     segment_attributes_t attr;
     uint32_t   limit;