ia64/xen-unstable

changeset 15086:6087058857c5

xen: Fix struct-size checker for unions and long names.
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author Keir Fraser <keir@xensource.com>
date Sat May 12 12:43:16 2007 +0100 (2007-05-12)
parents e527b4ff1948
children e33cce8fa400
files 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/xen/include/public/foreign/mkchecker.py	Sat May 12 12:41:40 2007 +0100
     1.2 +++ b/xen/include/public/foreign/mkchecker.py	Sat May 12 12:43:16 2007 +0100
     1.3 @@ -29,14 +29,14 @@ for a in archs:
     1.4  f.write('int main(int argc, char *argv[])\n{\n');
     1.5  
     1.6  f.write('\tprintf("\\n");');
     1.7 -f.write('printf("%-20s |", "structs");\n');
     1.8 +f.write('printf("%-25s |", "structs");\n');
     1.9  for a in archs:
    1.10      f.write('\tprintf("%%8s", "%s");\n' % a);
    1.11  f.write('\tprintf("\\n");');
    1.12  
    1.13  f.write('\tprintf("\\n");');
    1.14  for struct in structs:
    1.15 -    f.write('\tprintf("%%-20s |", "%s");\n' % struct);
    1.16 +    f.write('\tprintf("%%-25s |", "%s");\n' % struct);
    1.17      for a in archs:
    1.18          if a == arch:
    1.19              s = struct; # native
     2.1 --- a/xen/include/public/foreign/mkheader.py	Sat May 12 12:41:40 2007 +0100
     2.2 +++ b/xen/include/public/foreign/mkheader.py	Sat May 12 12:43:16 2007 +0100
     2.3 @@ -1,7 +1,7 @@
     2.4  #!/usr/bin/python
     2.5  
     2.6  import sys, re;
     2.7 -from structs import structs, defines;
     2.8 +from structs import unions, structs, defines;
     2.9  
    2.10  # command line arguments
    2.11  arch    = sys.argv[1];
    2.12 @@ -110,6 +110,16 @@ input = re.sub("#define[^\n]+\n", "", in
    2.13  input = re.compile("/\*(.*?)\*/", re.S).sub("", input)
    2.14  input = re.compile("\n\s*\n", re.S).sub("\n", input);
    2.15  
    2.16 +# add unions to output
    2.17 +for union in unions:
    2.18 +    regex = "union\s+%s\s*\{(.*?)\n\};" % union;
    2.19 +    match = re.search(regex, input, re.S)
    2.20 +    if None == match:
    2.21 +        output += "#define %s_has_no_%s 1\n" % (arch, union);
    2.22 +    else:
    2.23 +        output += "union %s_%s {%s\n};\n" % (union, arch, match.group(1));
    2.24 +    output += "\n";
    2.25 +
    2.26  # add structs to output
    2.27  for struct in structs:
    2.28      regex = "struct\s+%s\s*\{(.*?)\n\};" % struct;
    2.29 @@ -135,6 +145,10 @@ for define in defines:
    2.30          replace = define + "_" + arch;
    2.31      output = re.sub("\\b%s\\b" % define, replace, output);
    2.32  
    2.33 +# replace: unions
    2.34 +for union in unions:
    2.35 +    output = re.sub("\\b(union\s+%s)\\b" % union, "\\1_%s" % arch, output);
    2.36 +
    2.37  # replace: structs + struct typedefs
    2.38  for struct in structs:
    2.39      output = re.sub("\\b(struct\s+%s)\\b" % struct, "\\1_%s" % arch, output);
     3.1 --- a/xen/include/public/foreign/reference.size	Sat May 12 12:41:40 2007 +0100
     3.2 +++ b/xen/include/public/foreign/reference.size	Sat May 12 12:43:16 2007 +0100
     3.3 @@ -1,17 +1,17 @@
     3.4  
     3.5 -structs              |  x86_32  x86_64    ia64
     3.6 +structs                   |  x86_32  x86_64    ia64
     3.7  
     3.8 -start_info           |    1104    1152    1152
     3.9 -trap_info            |       8      16       -
    3.10 -pt_fpreg             |       -       -      16
    3.11 -cpu_user_regs        |      68     200     496
    3.12 -xen_ia64_boot_param  |       -       -      96
    3.13 -ia64_tr_entry        |       -       -      32
    3.14 -vcpu_extra_regs      |       -       -     536
    3.15 -vcpu_guest_context   |    2800    5168    1056
    3.16 -arch_vcpu_info       |      24      16       0
    3.17 -vcpu_time_info       |      32      32      32
    3.18 -vcpu_info            |      64      64      48
    3.19 -arch_shared_info     |     268     280     272
    3.20 -shared_info          |    2584    3368    4384
    3.21 +start_info                |    1104    1152    1152
    3.22 +trap_info                 |       8      16       -
    3.23 +pt_fpreg                  |       -       -      16
    3.24 +cpu_user_regs             |      68     200     496
    3.25 +xen_ia64_boot_param       |       -       -      96
    3.26 +ia64_tr_entry             |       -       -      32
    3.27 +vcpu_extra_regs           |       -       -     536
    3.28 +vcpu_guest_context        |    2800    5168    1056
    3.29 +arch_vcpu_info            |      24      16       0
    3.30 +vcpu_time_info            |      32      32      32
    3.31 +vcpu_info                 |      64      64      48
    3.32 +arch_shared_info          |     268     280     272
    3.33 +shared_info               |    2584    3368    4384
    3.34  
     4.1 --- a/xen/include/public/foreign/structs.py	Sat May 12 12:41:40 2007 +0100
     4.2 +++ b/xen/include/public/foreign/structs.py	Sat May 12 12:43:16 2007 +0100
     4.3 @@ -1,5 +1,7 @@
     4.4  # configuration: what needs translation
     4.5  
     4.6 +unions  = [ ];
     4.7 +
     4.8  structs = [ "start_info",
     4.9              "trap_info",
    4.10              "pt_fpreg",