From f07cb646ff013b631a6efb53bb0e38ea9b2e7c60 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Fri, 19 Jul 2013 12:51:09 +0100 Subject: xen: arm: include public/xen.h in foreign interface checking 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. This cannot cope with #defines between the #ifdef and the struct definitions, so move MAX_GUEST_CMDLINE to be next to its only usage. Signed-off-by: Ian Campbell Acked-by: Keir Fraser Acked-by: Ian Jackson --- 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 ++ 4 files changed, 18 insertions(+), 12 deletions(-) (limited to 'tools/include') diff --git a/tools/include/xen-foreign/Makefile b/tools/include/xen-foreign/Makefile index 8e0be83f1d..06b844c143 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 b19292ff03..0504cb8d5b 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 de36455453..b3347b434c 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 0b33a77480..476eb85f06 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 -- cgit v1.2.3