xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xen.org
Cc: "Keir (Xen.org)" <keir@xen.org>,
	Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Tim Deegan <tim@xen.org>,
	ian.jackson@eu.citrix.com, Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 4/5] tools: foreign: add checks for compatible architectures
Date: Thu, 18 Jul 2013 14:15:39 +0100	[thread overview]
Message-ID: <1374153340-29398-4-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1374153311.26728.86.camel@kazak.uk.xensource.com>

That is architectures whose struct layout must be identical. Use this for arm32
and arm64.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Keir (Xen.org) <keir@xen.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 tools/include/xen-foreign/mkchecker.py |   21 +++++++++++++++++++--
 tools/include/xen-foreign/structs.py   |    5 +++++
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/tools/include/xen-foreign/mkchecker.py b/tools/include/xen-foreign/mkchecker.py
index 66c17b1..fdad869 100644
--- a/tools/include/xen-foreign/mkchecker.py
+++ b/tools/include/xen-foreign/mkchecker.py
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 
 import sys;
-from structs import structs;
+from structs import structs, compat_arches;
 
 # command line arguments
 outfile = sys.argv[1];
@@ -37,10 +37,27 @@ for struct in structs:
     f.write('\tprintf("%%-25s |", "%s");\n' % struct);
     for a in archs:
         s = struct + "_" + a;
+        if compat_arches.has_key(a):
+            compat = compat_arches[a]
+            c = struct + "_" + compat;
+        else:
+            compat = None
         f.write('#ifdef %s_has_no_%s\n' % (a, struct));
-        f.write('\tprintf("%8s", "-");\n');
+        f.write('\tprintf("%8s",\n');
+        if compat:
+            f.write('# ifndef %s_has_no_%s\n' % (compat, struct));
+            f.write('\t\t"!"\n');
+            f.write('# else\n')
+            f.write('\t\t"-"\n');
+            f.write('# endif\n')
+        else:
+            f.write('\t\t"-"\n');
+        f.write('\t);\n')
         f.write("#else\n");
         f.write('\tprintf("%%8zd", sizeof(struct %s));\n' % s);
+        if compat:
+            f.write('\tif (sizeof(struct %s) != sizeof(struct %s))\n' % (s, c))
+            f.write('\t\tprintf("!");\n')
         f.write("#endif\n");
 
     f.write('\tprintf("\\n");\n\n');
diff --git a/tools/include/xen-foreign/structs.py b/tools/include/xen-foreign/structs.py
index 476eb85..3d9f2fe 100644
--- a/tools/include/xen-foreign/structs.py
+++ b/tools/include/xen-foreign/structs.py
@@ -58,3 +58,8 @@ defines = [ "__arm__",
             "XEN_LEGACY_MAX_VCPUS",
             "MAX_GUEST_CMDLINE" ];
 
+# Architectures which must be compatible, i.e. identical
+compat_arches = {
+    'arm32': 'arm64',
+    'arm64': 'arm32',
+}
-- 
1.7.2.5

  parent reply	other threads:[~2013-07-18 13:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-18 13:15 [PATCH v5 0/5] xen: public interface and foreign struct check changes for arm Ian Campbell
2013-07-18 13:15 ` [PATCH 1/5] xen/compat: support XEN_HAVE_FOO ifdefs in public interface Ian Campbell
2013-07-18 13:15 ` [PATCH 2/5] xen: only expose start_info on architectures which have a PV boot path Ian Campbell
2013-07-18 13:38   ` Jan Beulich
2013-07-18 13:57     ` Ian Campbell
2013-07-18 14:04       ` Jan Beulich
2013-07-18 14:08         ` Ian Campbell
2013-07-18 14:12           ` Jan Beulich
2013-07-18 14:31             ` Ian Campbell
2013-07-18 13:15 ` [PATCH 3/5] xen: arm: include public/xen.h in foreign interface checking Ian Campbell
2013-07-18 13:15 ` Ian Campbell [this message]
2013-07-18 13:15 ` [PATCH 5/5] xen: remove evtchn_upcall_mask from interface on ARM Ian Campbell
2013-07-18 13:40   ` Jan Beulich
2013-07-18 14:36   ` Ian Campbell
2013-07-18 13:42 ` [PATCH v5 0/5] xen: public interface and foreign struct check changes for arm Jan Beulich
2013-07-18 13:48   ` Ian Campbell

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=1374153340-29398-4-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=keir@xen.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --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).