ia64/xen-unstable

changeset 16919:afa521cf82e6

Move remaining xen/include/public/foreign files to tools/include/xen-foreign
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Sun Jan 27 17:25:56 2008 +0000 (2008-01-27)
parents 226de1674b2f
children 1fbab289fed1
files tools/include/xen-foreign/Makefile tools/include/xen-foreign/mkchecker.py tools/include/xen-foreign/mkheader.py tools/include/xen-foreign/reference.size tools/include/xen-foreign/structs.py xen/include/public/foreign/mkchecker.py xen/include/public/foreign/mkheader.py xen/include/public/foreign/reference.size xen/include/public/foreign/structs.py
line diff
     1.1 --- a/tools/include/xen-foreign/Makefile	Sun Jan 27 17:05:47 2008 +0000
     1.2 +++ b/tools/include/xen-foreign/Makefile	Sun Jan 27 17:25:56 2008 +0000
     1.3 @@ -2,10 +2,6 @@ XEN_ROOT=../../..
     1.4  include $(XEN_ROOT)/Config.mk
     1.5  
     1.6  ROOT = $(XEN_ROOT)/xen/include/public
     1.7 -HOSTCFLAGS += -I$(ROOT)/foreign
     1.8 -
     1.9 -MKCHECKER_PY = $(ROOT)/foreign/mkchecker.py
    1.10 -MKHEADER_PY = $(ROOT)/foreign/mkheader.py
    1.11  
    1.12  architectures := x86_32 x86_64 ia64
    1.13  headers := $(patsubst %, %.h, $(architectures))
    1.14 @@ -23,17 +19,17 @@ checker: checker.c $(headers)
    1.15  
    1.16  check-headers: checker
    1.17  	./checker > tmp.size
    1.18 -	diff -u $(ROOT)/foreign/reference.size tmp.size
    1.19 +	diff -u reference.size tmp.size
    1.20  	rm tmp.size
    1.21  
    1.22 -x86_32.h: $(MKHEADER_PY) $(ROOT)/arch-x86/xen-x86_32.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
    1.23 +x86_32.h: mkheader.py $(ROOT)/arch-x86/xen-x86_32.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
    1.24  	python $< $* $@ $(filter %.h,$^)
    1.25  
    1.26 -x86_64.h: $(MKHEADER_PY) $(ROOT)/arch-x86/xen-x86_64.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
    1.27 +x86_64.h: mkheader.py $(ROOT)/arch-x86/xen-x86_64.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
    1.28  	python $< $* $@ $(filter %.h,$^)
    1.29  
    1.30 -ia64.h: $(MKHEADER_PY) $(ROOT)/arch-ia64.h $(ROOT)/xen.h
    1.31 +ia64.h: mkheader.py $(ROOT)/arch-ia64.h $(ROOT)/xen.h
    1.32  	python $< $* $@ $(filter %.h,$^)
    1.33  
    1.34 -checker.c: $(MKCHECKER_PY)
    1.35 +checker.c: mkchecker.py
    1.36  	python $< $@ $(architectures)
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/include/xen-foreign/mkchecker.py	Sun Jan 27 17:25:56 2008 +0000
     2.3 @@ -0,0 +1,53 @@
     2.4 +#!/usr/bin/python
     2.5 +
     2.6 +import sys;
     2.7 +from structs import structs;
     2.8 +
     2.9 +# command line arguments
    2.10 +outfile = sys.argv[1];
    2.11 +archs   = sys.argv[2:];
    2.12 +
    2.13 +f = open(outfile, "w");
    2.14 +f.write('''
    2.15 +/*
    2.16 + * sanity checks for generated foreign headers:
    2.17 + *  - verify struct sizes
    2.18 + *
    2.19 + * generated by %s -- DO NOT EDIT
    2.20 + */
    2.21 +#include <stdio.h>
    2.22 +#include <stdlib.h>
    2.23 +#include <stddef.h>
    2.24 +#include <inttypes.h>
    2.25 +''');
    2.26 +
    2.27 +for a in archs:
    2.28 +    f.write('#include "%s.h"\n' % a);
    2.29 +
    2.30 +f.write('int main(int argc, char *argv[])\n{\n');
    2.31 +
    2.32 +f.write('\tprintf("\\n");');
    2.33 +f.write('printf("%-25s |", "structs");\n');
    2.34 +for a in archs:
    2.35 +    f.write('\tprintf("%%8s", "%s");\n' % a);
    2.36 +f.write('\tprintf("\\n");');
    2.37 +
    2.38 +f.write('\tprintf("\\n");');
    2.39 +for struct in structs:
    2.40 +    f.write('\tprintf("%%-25s |", "%s");\n' % struct);
    2.41 +    for a in archs:
    2.42 +        s = struct + "_" + a;
    2.43 +        f.write('#ifdef %s_has_no_%s\n' % (a, struct));
    2.44 +        f.write('\tprintf("%8s", "-");\n');
    2.45 +        f.write("#else\n");
    2.46 +        f.write('\tprintf("%%8zd", sizeof(struct %s));\n' % s);
    2.47 +        f.write("#endif\n");
    2.48 +
    2.49 +    f.write('\tprintf("\\n");\n\n');
    2.50 +
    2.51 +f.write('\tprintf("\\n");\n');
    2.52 +f.write('\texit(0);\n');
    2.53 +f.write('}\n');
    2.54 +
    2.55 +f.close();
    2.56 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tools/include/xen-foreign/mkheader.py	Sun Jan 27 17:25:56 2008 +0000
     3.3 @@ -0,0 +1,167 @@
     3.4 +#!/usr/bin/python
     3.5 +
     3.6 +import sys, re;
     3.7 +from structs import unions, structs, defines;
     3.8 +
     3.9 +# command line arguments
    3.10 +arch    = sys.argv[1];
    3.11 +outfile = sys.argv[2];
    3.12 +infiles = sys.argv[3:];
    3.13 +
    3.14 +
    3.15 +###########################################################################
    3.16 +# configuration #2: architecture information
    3.17 +
    3.18 +inttypes = {};
    3.19 +header = {};
    3.20 +footer = {};
    3.21 +
    3.22 +# x86_32
    3.23 +inttypes["x86_32"] = {
    3.24 +    "unsigned long" : "uint32_t",
    3.25 +    "long"          : "uint32_t",
    3.26 +    "xen_pfn_t"     : "uint32_t",
    3.27 +};
    3.28 +header["x86_32"] = """
    3.29 +#define __i386___X86_32 1
    3.30 +#pragma pack(4)
    3.31 +""";
    3.32 +footer["x86_32"] = """
    3.33 +#pragma pack()
    3.34 +""";
    3.35 +
    3.36 +# x86_64
    3.37 +inttypes["x86_64"] = {
    3.38 +    "unsigned long" : "__align8__ uint64_t",
    3.39 +    "long"          : "__align8__ uint64_t",
    3.40 +    "xen_pfn_t"     : "__align8__ uint64_t",
    3.41 +};
    3.42 +header["x86_64"] = """
    3.43 +#ifdef __GNUC__
    3.44 +# define __DECL_REG(name) union { uint64_t r ## name, e ## name; }
    3.45 +# define __align8__ __attribute__((aligned (8)))
    3.46 +#else
    3.47 +# define __DECL_REG(name) uint64_t r ## name
    3.48 +# define __align8__ FIXME
    3.49 +#endif
    3.50 +#define __x86_64___X86_64 1
    3.51 +""";
    3.52 +
    3.53 +# ia64
    3.54 +inttypes["ia64"] = {
    3.55 +    "unsigned long" : "__align8__ uint64_t",
    3.56 +    "long"          : "__align8__ uint64_t",
    3.57 +    "xen_pfn_t"     : "__align8__ uint64_t",
    3.58 +    "long double"   : "__align16__ ldouble_t",
    3.59 +};
    3.60 +header["ia64"] = """
    3.61 +#define __align8__ __attribute__((aligned (8)))
    3.62 +#define __align16__ __attribute__((aligned (16)))
    3.63 +typedef unsigned char ldouble_t[16];
    3.64 +""";
    3.65 +
    3.66 +
    3.67 +###########################################################################
    3.68 +# main
    3.69 +
    3.70 +input  = "";
    3.71 +output = "";
    3.72 +fileid = re.sub("[-.]", "_", "__FOREIGN_%s__" % outfile.upper());
    3.73 +
    3.74 +# read input header files
    3.75 +for name in infiles:
    3.76 +    f = open(name, "r");
    3.77 +    input += f.read();
    3.78 +    f.close();
    3.79 +
    3.80 +# add header
    3.81 +output += """
    3.82 +/*
    3.83 + * public xen defines and struct for %s
    3.84 + * generated by %s -- DO NOT EDIT
    3.85 + */
    3.86 +
    3.87 +#ifndef %s
    3.88 +#define %s 1
    3.89 +
    3.90 +""" % (arch, sys.argv[0], fileid, fileid)
    3.91 +
    3.92 +if arch in header:
    3.93 +    output += header[arch];
    3.94 +    output += "\n";
    3.95 +
    3.96 +# add defines to output
    3.97 +for line in re.findall("#define[^\n]+", input):
    3.98 +    for define in defines:
    3.99 +        regex = "#define\s+%s\\b" % define;
   3.100 +        match = re.search(regex, line);
   3.101 +        if None == match:
   3.102 +            continue;
   3.103 +        if define.upper()[0] == define[0]:
   3.104 +            replace = define + "_" + arch.upper();
   3.105 +        else:
   3.106 +            replace = define + "_" + arch;
   3.107 +        regex = "\\b%s\\b" % define;
   3.108 +        output += re.sub(regex, replace, line) + "\n";
   3.109 +output += "\n";
   3.110 +
   3.111 +# delete defines, comments, empty lines
   3.112 +input = re.sub("#define[^\n]+\n", "", input);
   3.113 +input = re.compile("/\*(.*?)\*/", re.S).sub("", input)
   3.114 +input = re.compile("\n\s*\n", re.S).sub("\n", input);
   3.115 +
   3.116 +# add unions to output
   3.117 +for union in unions:
   3.118 +    regex = "union\s+%s\s*\{(.*?)\n\};" % union;
   3.119 +    match = re.search(regex, input, re.S)
   3.120 +    if None == match:
   3.121 +        output += "#define %s_has_no_%s 1\n" % (arch, union);
   3.122 +    else:
   3.123 +        output += "union %s_%s {%s\n};\n" % (union, arch, match.group(1));
   3.124 +    output += "\n";
   3.125 +
   3.126 +# add structs to output
   3.127 +for struct in structs:
   3.128 +    regex = "struct\s+%s\s*\{(.*?)\n\};" % struct;
   3.129 +    match = re.search(regex, input, re.S)
   3.130 +    if None == match:
   3.131 +        output += "#define %s_has_no_%s 1\n" % (arch, struct);
   3.132 +    else:
   3.133 +        output += "struct %s_%s {%s\n};\n" % (struct, arch, match.group(1));
   3.134 +        output += "typedef struct %s_%s %s_%s_t;\n" % (struct, arch, struct, arch);
   3.135 +    output += "\n";
   3.136 +
   3.137 +# add footer
   3.138 +if arch in footer:
   3.139 +    output += footer[arch];
   3.140 +    output += "\n";
   3.141 +output += "#endif /* %s */\n" % fileid;
   3.142 +
   3.143 +# replace: defines
   3.144 +for define in defines:
   3.145 +    if define.upper()[0] == define[0]:
   3.146 +        replace = define + "_" + arch.upper();
   3.147 +    else:
   3.148 +        replace = define + "_" + arch;
   3.149 +    output = re.sub("\\b%s\\b" % define, replace, output);
   3.150 +
   3.151 +# replace: unions
   3.152 +for union in unions:
   3.153 +    output = re.sub("\\b(union\s+%s)\\b" % union, "\\1_%s" % arch, output);
   3.154 +
   3.155 +# replace: structs + struct typedefs
   3.156 +for struct in structs:
   3.157 +    output = re.sub("\\b(struct\s+%s)\\b" % struct, "\\1_%s" % arch, output);
   3.158 +    output = re.sub("\\b(%s)_t\\b" % struct, "\\1_%s_t" % arch, output);
   3.159 +
   3.160 +# replace: integer types
   3.161 +integers = inttypes[arch].keys();
   3.162 +integers.sort(lambda a, b: cmp(len(b),len(a)));
   3.163 +for type in integers:
   3.164 +    output = re.sub("\\b%s\\b" % type, inttypes[arch][type], output);
   3.165 +
   3.166 +# print results
   3.167 +f = open(outfile, "w");
   3.168 +f.write(output);
   3.169 +f.close;
   3.170 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tools/include/xen-foreign/reference.size	Sun Jan 27 17:25:56 2008 +0000
     4.3 @@ -0,0 +1,18 @@
     4.4 +
     4.5 +structs                   |  x86_32  x86_64    ia64
     4.6 +
     4.7 +start_info                |    1104    1152    1152
     4.8 +trap_info                 |       8      16       -
     4.9 +pt_fpreg                  |       -       -      16
    4.10 +cpu_user_regs             |      68     200       -
    4.11 +xen_ia64_boot_param       |       -       -      96
    4.12 +ia64_tr_entry             |       -       -      32
    4.13 +vcpu_tr_regs              |       -       -     768
    4.14 +vcpu_guest_context_regs   |       -       -   22176
    4.15 +vcpu_guest_context        |    2800    5168   22208
    4.16 +arch_vcpu_info            |      24      16       0
    4.17 +vcpu_time_info            |      32      32      32
    4.18 +vcpu_info                 |      64      64      48
    4.19 +arch_shared_info          |     268     280     272
    4.20 +shared_info               |    2584    3368    4384
    4.21 +
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/tools/include/xen-foreign/structs.py	Sun Jan 27 17:25:56 2008 +0000
     5.3 @@ -0,0 +1,58 @@
     5.4 +# configuration: what needs translation
     5.5 +
     5.6 +unions  = [ "vcpu_cr_regs",
     5.7 +            "vcpu_ar_regs" ];
     5.8 +
     5.9 +structs = [ "start_info",
    5.10 +            "trap_info",
    5.11 +            "pt_fpreg",
    5.12 +            "cpu_user_regs",
    5.13 +            "xen_ia64_boot_param",
    5.14 +            "ia64_tr_entry",
    5.15 +            "vcpu_tr_regs",
    5.16 +            "vcpu_guest_context_regs",
    5.17 +            "vcpu_guest_context",
    5.18 +            "arch_vcpu_info",
    5.19 +            "vcpu_time_info",
    5.20 +            "vcpu_info",
    5.21 +            "arch_shared_info",
    5.22 +            "shared_info" ];
    5.23 +
    5.24 +defines = [ "__i386__",
    5.25 +            "__x86_64__",
    5.26 +
    5.27 +            "FLAT_RING1_CS",
    5.28 +            "FLAT_RING1_DS",
    5.29 +            "FLAT_RING1_SS",
    5.30 +
    5.31 +            "FLAT_RING3_CS64",
    5.32 +            "FLAT_RING3_DS64",
    5.33 +            "FLAT_RING3_SS64",
    5.34 +            "FLAT_KERNEL_CS64",
    5.35 +            "FLAT_KERNEL_DS64",
    5.36 +            "FLAT_KERNEL_SS64",
    5.37 +
    5.38 +            "FLAT_KERNEL_CS",
    5.39 +            "FLAT_KERNEL_DS",
    5.40 +            "FLAT_KERNEL_SS",
    5.41 +
    5.42 +            # x86_{32,64}
    5.43 +            "_VGCF_i387_valid",
    5.44 +            "VGCF_i387_valid",
    5.45 +            "_VGCF_in_kernel",
    5.46 +            "VGCF_in_kernel",
    5.47 +            "_VGCF_failsafe_disables_events",
    5.48 +            "VGCF_failsafe_disables_events",
    5.49 +            "_VGCF_syscall_disables_events",
    5.50 +            "VGCF_syscall_disables_events",
    5.51 +            "_VGCF_online",
    5.52 +            "VGCF_online",
    5.53 +
    5.54 +            # ia64
    5.55 +            "VGCF_EXTRA_REGS",
    5.56 +
    5.57 +            # all archs
    5.58 +            "xen_pfn_to_cr3",
    5.59 +            "MAX_VIRT_CPUS",
    5.60 +            "MAX_GUEST_CMDLINE" ];
    5.61 +
     6.1 --- a/xen/include/public/foreign/mkchecker.py	Sun Jan 27 17:05:47 2008 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,54 +0,0 @@
     6.4 -#!/usr/bin/python
     6.5 -
     6.6 -import sys;
     6.7 -from structs import structs;
     6.8 -
     6.9 -# command line arguments
    6.10 -outfile = sys.argv[1];
    6.11 -archs   = sys.argv[2:];
    6.12 -
    6.13 -f = open(outfile, "w");
    6.14 -f.write('''
    6.15 -/*
    6.16 - * sanity checks for generated foreign headers:
    6.17 - *  - verify struct sizes
    6.18 - *
    6.19 - * generated by %s -- DO NOT EDIT
    6.20 - */
    6.21 -#include <stdio.h>
    6.22 -#include <stdlib.h>
    6.23 -#include <stddef.h>
    6.24 -#include <inttypes.h>
    6.25 -#include "../xen.h"
    6.26 -''');
    6.27 -
    6.28 -for a in archs:
    6.29 -    f.write('#include "%s.h"\n' % a);
    6.30 -
    6.31 -f.write('int main(int argc, char *argv[])\n{\n');
    6.32 -
    6.33 -f.write('\tprintf("\\n");');
    6.34 -f.write('printf("%-25s |", "structs");\n');
    6.35 -for a in archs:
    6.36 -    f.write('\tprintf("%%8s", "%s");\n' % a);
    6.37 -f.write('\tprintf("\\n");');
    6.38 -
    6.39 -f.write('\tprintf("\\n");');
    6.40 -for struct in structs:
    6.41 -    f.write('\tprintf("%%-25s |", "%s");\n' % struct);
    6.42 -    for a in archs:
    6.43 -        s = struct + "_" + a;
    6.44 -        f.write('#ifdef %s_has_no_%s\n' % (a, struct));
    6.45 -        f.write('\tprintf("%8s", "-");\n');
    6.46 -        f.write("#else\n");
    6.47 -        f.write('\tprintf("%%8zd", sizeof(struct %s));\n' % s);
    6.48 -        f.write("#endif\n");
    6.49 -
    6.50 -    f.write('\tprintf("\\n");\n\n');
    6.51 -
    6.52 -f.write('\tprintf("\\n");\n');
    6.53 -f.write('\texit(0);\n');
    6.54 -f.write('}\n');
    6.55 -
    6.56 -f.close();
    6.57 -
     7.1 --- a/xen/include/public/foreign/mkheader.py	Sun Jan 27 17:05:47 2008 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,167 +0,0 @@
     7.4 -#!/usr/bin/python
     7.5 -
     7.6 -import sys, re;
     7.7 -from structs import unions, structs, defines;
     7.8 -
     7.9 -# command line arguments
    7.10 -arch    = sys.argv[1];
    7.11 -outfile = sys.argv[2];
    7.12 -infiles = sys.argv[3:];
    7.13 -
    7.14 -
    7.15 -###########################################################################
    7.16 -# configuration #2: architecture information
    7.17 -
    7.18 -inttypes = {};
    7.19 -header = {};
    7.20 -footer = {};
    7.21 -
    7.22 -# x86_32
    7.23 -inttypes["x86_32"] = {
    7.24 -    "unsigned long" : "uint32_t",
    7.25 -    "long"          : "uint32_t",
    7.26 -    "xen_pfn_t"     : "uint32_t",
    7.27 -};
    7.28 -header["x86_32"] = """
    7.29 -#define __i386___X86_32 1
    7.30 -#pragma pack(4)
    7.31 -""";
    7.32 -footer["x86_32"] = """
    7.33 -#pragma pack()
    7.34 -""";
    7.35 -
    7.36 -# x86_64
    7.37 -inttypes["x86_64"] = {
    7.38 -    "unsigned long" : "__align8__ uint64_t",
    7.39 -    "long"          : "__align8__ uint64_t",
    7.40 -    "xen_pfn_t"     : "__align8__ uint64_t",
    7.41 -};
    7.42 -header["x86_64"] = """
    7.43 -#ifdef __GNUC__
    7.44 -# define __DECL_REG(name) union { uint64_t r ## name, e ## name; }
    7.45 -# define __align8__ __attribute__((aligned (8)))
    7.46 -#else
    7.47 -# define __DECL_REG(name) uint64_t r ## name
    7.48 -# define __align8__ FIXME
    7.49 -#endif
    7.50 -#define __x86_64___X86_64 1
    7.51 -""";
    7.52 -
    7.53 -# ia64
    7.54 -inttypes["ia64"] = {
    7.55 -    "unsigned long" : "__align8__ uint64_t",
    7.56 -    "long"          : "__align8__ uint64_t",
    7.57 -    "xen_pfn_t"     : "__align8__ uint64_t",
    7.58 -    "long double"   : "__align16__ ldouble_t",
    7.59 -};
    7.60 -header["ia64"] = """
    7.61 -#define __align8__ __attribute__((aligned (8)))
    7.62 -#define __align16__ __attribute__((aligned (16)))
    7.63 -typedef unsigned char ldouble_t[16];
    7.64 -""";
    7.65 -
    7.66 -
    7.67 -###########################################################################
    7.68 -# main
    7.69 -
    7.70 -input  = "";
    7.71 -output = "";
    7.72 -fileid = re.sub("[-.]", "_", "__FOREIGN_%s__" % outfile.upper());
    7.73 -
    7.74 -# read input header files
    7.75 -for name in infiles:
    7.76 -    f = open(name, "r");
    7.77 -    input += f.read();
    7.78 -    f.close();
    7.79 -
    7.80 -# add header
    7.81 -output += """
    7.82 -/*
    7.83 - * public xen defines and struct for %s
    7.84 - * generated by %s -- DO NOT EDIT
    7.85 - */
    7.86 -
    7.87 -#ifndef %s
    7.88 -#define %s 1
    7.89 -
    7.90 -""" % (arch, sys.argv[0], fileid, fileid)
    7.91 -
    7.92 -if arch in header:
    7.93 -    output += header[arch];
    7.94 -    output += "\n";
    7.95 -
    7.96 -# add defines to output
    7.97 -for line in re.findall("#define[^\n]+", input):
    7.98 -    for define in defines:
    7.99 -        regex = "#define\s+%s\\b" % define;
   7.100 -        match = re.search(regex, line);
   7.101 -        if None == match:
   7.102 -            continue;
   7.103 -        if define.upper()[0] == define[0]:
   7.104 -            replace = define + "_" + arch.upper();
   7.105 -        else:
   7.106 -            replace = define + "_" + arch;
   7.107 -        regex = "\\b%s\\b" % define;
   7.108 -        output += re.sub(regex, replace, line) + "\n";
   7.109 -output += "\n";
   7.110 -
   7.111 -# delete defines, comments, empty lines
   7.112 -input = re.sub("#define[^\n]+\n", "", input);
   7.113 -input = re.compile("/\*(.*?)\*/", re.S).sub("", input)
   7.114 -input = re.compile("\n\s*\n", re.S).sub("\n", input);
   7.115 -
   7.116 -# add unions to output
   7.117 -for union in unions:
   7.118 -    regex = "union\s+%s\s*\{(.*?)\n\};" % union;
   7.119 -    match = re.search(regex, input, re.S)
   7.120 -    if None == match:
   7.121 -        output += "#define %s_has_no_%s 1\n" % (arch, union);
   7.122 -    else:
   7.123 -        output += "union %s_%s {%s\n};\n" % (union, arch, match.group(1));
   7.124 -    output += "\n";
   7.125 -
   7.126 -# add structs to output
   7.127 -for struct in structs:
   7.128 -    regex = "struct\s+%s\s*\{(.*?)\n\};" % struct;
   7.129 -    match = re.search(regex, input, re.S)
   7.130 -    if None == match:
   7.131 -        output += "#define %s_has_no_%s 1\n" % (arch, struct);
   7.132 -    else:
   7.133 -        output += "struct %s_%s {%s\n};\n" % (struct, arch, match.group(1));
   7.134 -        output += "typedef struct %s_%s %s_%s_t;\n" % (struct, arch, struct, arch);
   7.135 -    output += "\n";
   7.136 -
   7.137 -# add footer
   7.138 -if arch in footer:
   7.139 -    output += footer[arch];
   7.140 -    output += "\n";
   7.141 -output += "#endif /* %s */\n" % fileid;
   7.142 -
   7.143 -# replace: defines
   7.144 -for define in defines:
   7.145 -    if define.upper()[0] == define[0]:
   7.146 -        replace = define + "_" + arch.upper();
   7.147 -    else:
   7.148 -        replace = define + "_" + arch;
   7.149 -    output = re.sub("\\b%s\\b" % define, replace, output);
   7.150 -
   7.151 -# replace: unions
   7.152 -for union in unions:
   7.153 -    output = re.sub("\\b(union\s+%s)\\b" % union, "\\1_%s" % arch, output);
   7.154 -
   7.155 -# replace: structs + struct typedefs
   7.156 -for struct in structs:
   7.157 -    output = re.sub("\\b(struct\s+%s)\\b" % struct, "\\1_%s" % arch, output);
   7.158 -    output = re.sub("\\b(%s)_t\\b" % struct, "\\1_%s_t" % arch, output);
   7.159 -
   7.160 -# replace: integer types
   7.161 -integers = inttypes[arch].keys();
   7.162 -integers.sort(lambda a, b: cmp(len(b),len(a)));
   7.163 -for type in integers:
   7.164 -    output = re.sub("\\b%s\\b" % type, inttypes[arch][type], output);
   7.165 -
   7.166 -# print results
   7.167 -f = open(outfile, "w");
   7.168 -f.write(output);
   7.169 -f.close;
   7.170 -
     8.1 --- a/xen/include/public/foreign/reference.size	Sun Jan 27 17:05:47 2008 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,18 +0,0 @@
     8.4 -
     8.5 -structs                   |  x86_32  x86_64    ia64
     8.6 -
     8.7 -start_info                |    1104    1152    1152
     8.8 -trap_info                 |       8      16       -
     8.9 -pt_fpreg                  |       -       -      16
    8.10 -cpu_user_regs             |      68     200       -
    8.11 -xen_ia64_boot_param       |       -       -      96
    8.12 -ia64_tr_entry             |       -       -      32
    8.13 -vcpu_tr_regs              |       -       -     768
    8.14 -vcpu_guest_context_regs   |       -       -   22176
    8.15 -vcpu_guest_context        |    2800    5168   22208
    8.16 -arch_vcpu_info            |      24      16       0
    8.17 -vcpu_time_info            |      32      32      32
    8.18 -vcpu_info                 |      64      64      48
    8.19 -arch_shared_info          |     268     280     272
    8.20 -shared_info               |    2584    3368    4384
    8.21 -
     9.1 --- a/xen/include/public/foreign/structs.py	Sun Jan 27 17:05:47 2008 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,58 +0,0 @@
     9.4 -# configuration: what needs translation
     9.5 -
     9.6 -unions  = [ "vcpu_cr_regs",
     9.7 -            "vcpu_ar_regs" ];
     9.8 -
     9.9 -structs = [ "start_info",
    9.10 -            "trap_info",
    9.11 -            "pt_fpreg",
    9.12 -            "cpu_user_regs",
    9.13 -            "xen_ia64_boot_param",
    9.14 -            "ia64_tr_entry",
    9.15 -            "vcpu_tr_regs",
    9.16 -            "vcpu_guest_context_regs",
    9.17 -            "vcpu_guest_context",
    9.18 -            "arch_vcpu_info",
    9.19 -            "vcpu_time_info",
    9.20 -            "vcpu_info",
    9.21 -            "arch_shared_info",
    9.22 -            "shared_info" ];
    9.23 -
    9.24 -defines = [ "__i386__",
    9.25 -            "__x86_64__",
    9.26 -
    9.27 -            "FLAT_RING1_CS",
    9.28 -            "FLAT_RING1_DS",
    9.29 -            "FLAT_RING1_SS",
    9.30 -
    9.31 -            "FLAT_RING3_CS64",
    9.32 -            "FLAT_RING3_DS64",
    9.33 -            "FLAT_RING3_SS64",
    9.34 -            "FLAT_KERNEL_CS64",
    9.35 -            "FLAT_KERNEL_DS64",
    9.36 -            "FLAT_KERNEL_SS64",
    9.37 -
    9.38 -            "FLAT_KERNEL_CS",
    9.39 -            "FLAT_KERNEL_DS",
    9.40 -            "FLAT_KERNEL_SS",
    9.41 -
    9.42 -            # x86_{32,64}
    9.43 -            "_VGCF_i387_valid",
    9.44 -            "VGCF_i387_valid",
    9.45 -            "_VGCF_in_kernel",
    9.46 -            "VGCF_in_kernel",
    9.47 -            "_VGCF_failsafe_disables_events",
    9.48 -            "VGCF_failsafe_disables_events",
    9.49 -            "_VGCF_syscall_disables_events",
    9.50 -            "VGCF_syscall_disables_events",
    9.51 -            "_VGCF_online",
    9.52 -            "VGCF_online",
    9.53 -
    9.54 -            # ia64
    9.55 -            "VGCF_EXTRA_REGS",
    9.56 -
    9.57 -            # all archs
    9.58 -            "xen_pfn_to_cr3",
    9.59 -            "MAX_VIRT_CPUS",
    9.60 -            "MAX_GUEST_CMDLINE" ];
    9.61 -