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, Ian Campbell <ian.campbell@citrix.com>,
	stefano.stabellini@eu.citrix.com, ian.jackson@eu.citrix.com,
	tim@xen.org, julien.grall@citrix.com,
	Jan Beulich <JBeulich@suse.com>
Subject: [PATCH v6 3/5] xen: arm: include public/xen.h in foreign interface checking
Date: Fri, 19 Jul 2013 12:51:09 +0100	[thread overview]
Message-ID: <1374234671-6547-3-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1374234595.13645.59.camel@kazak.uk.xensource.com>

mkheader.py doesn't cope with
	struct foo { };
so add a newline.

Define unsigned long and long to a non-existent type on ARM so as to catch
their use.

Teach mkheader.py to cope with structs which are ifdef'd.

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>
---
v3: rework for ifdeffed instead of moved start_info.
---
 tools/include/xen-foreign/Makefile       |    4 ++--
 tools/include/xen-foreign/mkheader.py    |   14 +++++++++-----
 tools/include/xen-foreign/reference.size |   10 +++++-----
 tools/include/xen-foreign/structs.py     |    2 ++
 xen/include/public/arch-arm.h            |    8 +++++---
 xen/include/public/xen.h                 |    2 +-
 6 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/tools/include/xen-foreign/Makefile b/tools/include/xen-foreign/Makefile
index 8e0be83..06b844c 100644
--- a/tools/include/xen-foreign/Makefile
+++ b/tools/include/xen-foreign/Makefile
@@ -22,10 +22,10 @@ check-headers: checker
 	diff -u reference.size tmp.size
 	rm tmp.size
 
-arm32.h: mkheader.py structs.py $(ROOT)/arch-arm.h
+arm32.h: mkheader.py structs.py $(ROOT)/arch-arm.h $(ROOT)/xen.h
 	$(PYTHON) $< $* $@ $(filter %.h,$^)
 
-arm64.h: mkheader.py structs.py $(ROOT)/arch-arm.h
+arm64.h: mkheader.py structs.py $(ROOT)/arch-arm.h $(ROOT)/xen.h
 	$(PYTHON) $< $* $@ $(filter %.h,$^)
 
 x86_32.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_32.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
diff --git a/tools/include/xen-foreign/mkheader.py b/tools/include/xen-foreign/mkheader.py
index b19292f..0504cb8 100644
--- a/tools/include/xen-foreign/mkheader.py
+++ b/tools/include/xen-foreign/mkheader.py
@@ -18,8 +18,8 @@ footer = {};
 
 #arm
 inttypes["arm32"] = {
-    "unsigned long" : "uint32_t",
-    "long"          : "uint32_t",
+    "unsigned long" : "__danger_unsigned_long_on_arm32",
+    "long"          : "__danger_long_on_arm32",
     "xen_pfn_t"     : "__align8__ uint64_t",
     "xen_ulong_t"   : "__align8__ uint64_t",
     "uint64_t"      : "__align8__ uint64_t",
@@ -124,6 +124,8 @@ if arch in header:
     output += header[arch];
     output += "\n";
 
+defined = {}
+
 # add defines to output
 for line in re.findall("#define[^\n]+", input):
     for define in defines:
@@ -131,6 +133,7 @@ for line in re.findall("#define[^\n]+", input):
         match = re.search(regex, line);
         if None == match:
             continue;
+        defined[define] = 1
         if define.upper()[0] == define[0]:
             replace = define + "_" + arch.upper();
         else:
@@ -156,12 +159,13 @@ for union in unions:
 
 # add structs to output
 for struct in structs:
-    regex = "struct\s+%s\s*\{(.*?)\n\};" % struct;
+    regex = "(?:#ifdef ([A-Z_]+))?\nstruct\s+%s\s*\{(.*?)\n\};" % struct;
     match = re.search(regex, input, re.S)
-    if None == match:
+    if None == match or \
+           (match.group(1) is not None and match.group(1) not in defined):
         output += "#define %s_has_no_%s 1\n" % (arch, struct);
     else:
-        output += "struct %s_%s {%s\n};\n" % (struct, arch, match.group(1));
+        output += "struct %s_%s {%s\n};\n" % (struct, arch, match.group(2));
         output += "typedef struct %s_%s %s_%s_t;\n" % (struct, arch, struct, arch);
     output += "\n";
 
diff --git a/tools/include/xen-foreign/reference.size b/tools/include/xen-foreign/reference.size
index de36455..b3347b4 100644
--- a/tools/include/xen-foreign/reference.size
+++ b/tools/include/xen-foreign/reference.size
@@ -6,9 +6,9 @@ trap_info                 |       -       -       8      16
 cpu_user_regs             |       -       -      68     200
 vcpu_guest_core_regs      |     304     304       -       -
 vcpu_guest_context        |     336     336    2800    5168
-arch_vcpu_info            |       -       -      24      16
-vcpu_time_info            |       -       -      32      32
-vcpu_info                 |       -       -      64      64
-arch_shared_info          |       -       -     268     280
-shared_info               |       -       -    2584    3368
+arch_vcpu_info            |       0       0      24      16
+vcpu_time_info            |      32      32      32      32
+vcpu_info                 |      48      48      64      64
+arch_shared_info          |       0       0     268     280
+shared_info               |    1088    1088    2584    3368
 
diff --git a/tools/include/xen-foreign/structs.py b/tools/include/xen-foreign/structs.py
index 0b33a77..476eb85 100644
--- a/tools/include/xen-foreign/structs.py
+++ b/tools/include/xen-foreign/structs.py
@@ -19,6 +19,8 @@ defines = [ "__arm__",
             "__i386__",
             "__x86_64__",
 
+            "XEN_HAVE_PV_GUEST_ENTRY",
+
             # arm
             # None
 
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index 8aa62d3..93c420c 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -195,14 +195,16 @@ struct vcpu_guest_context {
 typedef struct vcpu_guest_context vcpu_guest_context_t;
 DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
 
-struct arch_vcpu_info { };
+struct arch_vcpu_info {
+};
 typedef struct arch_vcpu_info arch_vcpu_info_t;
 
-struct arch_shared_info { };
+struct arch_shared_info {
+};
 typedef struct arch_shared_info arch_shared_info_t;
 typedef uint64_t xen_callback_t;
 
-#endif /* ifndef __ASSEMBLY __ */
+#endif
 
 /* PSR bits (CPSR, SPSR)*/
 
diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h
index 2414e7e..037540d 100644
--- a/xen/include/public/xen.h
+++ b/xen/include/public/xen.h
@@ -717,7 +717,6 @@ typedef struct shared_info shared_info_t;
  * pages preceding pt_base and mark them as reserved/unused.
  */
 #ifdef XEN_HAVE_PV_GUEST_ENTRY
-#define MAX_GUEST_CMDLINE 1024
 struct start_info {
     /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME.    */
     char magic[32];             /* "xen-<version>-<platform>".            */
@@ -744,6 +743,7 @@ struct start_info {
                                 /* (PFN of pre-loaded module if           */
                                 /*  SIF_MOD_START_PFN set in flags).      */
     unsigned long mod_len;      /* Size (bytes) of pre-loaded module.     */
+#define MAX_GUEST_CMDLINE 1024
     int8_t cmd_line[MAX_GUEST_CMDLINE];
     /* The pfn range here covers both page table and p->m table frames.   */
     unsigned long first_p2m_pfn;/* 1st pfn forming initial P->M table.    */
-- 
1.7.2.5

  parent reply	other threads:[~2013-07-19 11:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19 11:49 [PATCH v6 0/5] xen: public interface and foreign struct check changes for arm Ian Campbell
2013-07-19 11:51 ` [PATCH v6 1/5] xen/compat: support XEN_HAVE_FOO ifdefs in public interface Ian Campbell
2013-07-19 11:51 ` [PATCH v6 2/5] xen: only expose start_info on architectures which have a PV boot path Ian Campbell
2013-07-19 11:51 ` Ian Campbell [this message]
2013-08-07 15:48   ` [PATCH v6 3/5] xen: arm: include public/xen.h in foreign interface checking Ian Jackson
2013-08-08  8:38     ` Ian Campbell
2013-08-08 10:57       ` Ian Jackson
2013-08-08 14:44         ` Ian Campbell
2013-07-19 11:51 ` [PATCH v6 4/5] tools: foreign: add checks for compatible architectures Ian Campbell
2013-07-19 11:51 ` [PATCH v6 5/5] xen: remove evtchn_upcall_mask from interface on ARM Ian Campbell
2013-07-19 13:27 ` [PATCH v6 0/5] xen: public interface and foreign struct check changes for arm Keir Fraser
2013-07-19 13:40   ` Ian Campbell
2013-08-07 15:52 ` Ian Jackson
2013-08-20 15:02   ` 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=1374234671-6547-3-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=julien.grall@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).