From: Olaf Hering <olaf@aepfle.de>
To: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: xen-devel@lists.xensource.com
Subject: [PATCH] xenalyze: use packed structs with u64 members
Date: Tue, 14 Dec 2010 18:46:20 +0100 [thread overview]
Message-ID: <20101214174620.GA19442@aepfle.de> (raw)
George,
there is some padding after the first struct member if it is followed by
an unsigned long long. This happens with 64bit builds.
Adding an attribute to this struct fixes the size checks in
hvm_msr_write_process() for me. There are a few more places where the
padding will break things. This explains also the unexpected rip values.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
--- xenalyze.hg.orig/xenalyze.c
+++ xenalyze.hg/xenalyze.c
@@ -4138,7 +4138,7 @@ void hvm_cr_write_process(struct record_
struct {
unsigned cr;
unsigned long long val;
- } x64;
+ } __attribute__((packed)) x64;
} *r = (typeof(r))h->d;
unsigned cr;
unsigned long long val;
@@ -4204,7 +4204,7 @@ void hvm_msr_write_process(struct record
struct {
unsigned int addr;
unsigned long long val;
- } *r = (typeof(r))h->d;
+ } __attribute__((packed)) *r = (typeof(r))h->d;
int expected_extra=(sizeof(*r)/sizeof(unsigned int));
@@ -4256,7 +4256,7 @@ void hvm_msr_read_process(struct record_
struct {
unsigned int addr;
unsigned long long val;
- } *r = (typeof(r))h->d;
+ } __attribute__((packed)) *r = (typeof(r))h->d;
int expected_extra=(sizeof(*r)/sizeof(unsigned int));
@@ -4499,7 +4499,7 @@ void hvm_pf_inject_process(struct record
struct {
unsigned ec;
unsigned long long cr2;
- } x64;
+ } __attribute__((packed)) x64;
} *r = (typeof(r))h->d;
unsigned int ec;
unsigned long long cr2;
@@ -4945,7 +4945,7 @@ void hvm_vmexit_process(struct record_in
struct {
unsigned int exit_reason;
unsigned long long rip;
- } x64;
+ } __attribute__((packed)) x64;
struct {
unsigned int exit_reason;
unsigned int eip;
@@ -6788,7 +6788,7 @@ void sched_runstate_process(struct pcpu_
struct {
unsigned vcpu:16, dom:16;
unsigned long long p1, p2;
- } * r = (typeof(r))ri->d;
+ } __attribute__((packed)) * r = (typeof(r))ri->d;
union {
unsigned int event;
struct {
next reply other threads:[~2010-12-14 17:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-14 17:46 Olaf Hering [this message]
2010-12-14 17:50 ` [PATCH] xenalyze: add missing newline to fprintf Olaf Hering
2010-12-16 10:35 ` [PATCH] xenalyze: use correct sizeof argument when counting extra_data Olaf Hering
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=20101214174620.GA19442@aepfle.de \
--to=olaf@aepfle.de \
--cc=George.Dunlap@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/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).