From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: [PATCH 4/5] tools: foreign: add checks for compatible architectures Date: Thu, 18 Jul 2013 14:15:39 +0100 Message-ID: <1374153340-29398-4-git-send-email-ian.campbell@citrix.com> References: <1374153311.26728.86.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1374153311.26728.86.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: "Keir (Xen.org)" , Ian Campbell , Stefano Stabellini , Tim Deegan , ian.jackson@eu.citrix.com, Jan Beulich List-Id: xen-devel@lists.xenproject.org That is architectures whose struct layout must be identical. Use this for arm32 and arm64. Signed-off-by: Ian Campbell Cc: Jan Beulich Cc: Keir (Xen.org) Cc: Tim Deegan Cc: Stefano Stabellini --- 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