From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Wei Liu <wei.liu2@citrix.com>, Jan Beulich <JBeulich@suse.com>
Subject: [PATCH v2 for-4.9 1/2] x86/emul: Use explicit __attribute__((packed)) rather than __packed
Date: Tue, 25 Oct 2016 19:10:32 +0100 [thread overview]
Message-ID: <1477419033-24412-1-git-send-email-andrew.cooper3@citrix.com> (raw)
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 definitons intended for use by x86_emulate.c alone.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
---
tools/tests/x86_emulator/test_x86_emulator.c | 2 --
tools/tests/x86_emulator/x86_emulate.c | 6 ++----
xen/arch/x86/x86_emulate/x86_emulate.h | 4 ++--
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index 15d100a..6f6d70f 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -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"
diff --git a/tools/tests/x86_emulator/x86_emulate.c b/tools/tests/x86_emulator/x86_emulate.c
index 50a4262..af90b6e 100644
--- a/tools/tests/x86_emulator/x86_emulate.c
+++ b/tools/tests/x86_emulator/x86_emulate.c
@@ -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)
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h
index 641711e..2b39b81 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -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;
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next reply other threads:[~2016-10-25 18:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-25 18:10 Andrew Cooper [this message]
2016-10-25 18:10 ` [PATCH v2 for-4.9 2/2] x86/emul: Reorder the user segments in x86_segment to match SReg3 encoding Andrew Cooper
2016-10-26 8:57 ` Jan Beulich
2016-10-26 9:40 ` Andrew Cooper
2016-10-26 9:48 ` Andrew Cooper
2016-10-26 9:54 ` Jan Beulich
2016-10-26 9:57 ` Andrew Cooper
2016-10-26 10:16 ` Jan Beulich
2016-10-26 11:26 ` Andrew Cooper
2016-10-26 12:19 ` Jan Beulich
2016-10-26 8:54 ` [PATCH v2 for-4.9 1/2] x86/emul: Use explicit __attribute__((packed)) rather than __packed Jan Beulich
2016-10-26 9:39 ` Andrew Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1477419033-24412-1-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).