WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Allow checker to support unions

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Allow checker to support unions
From: Alex Williamson <alex.williamson@xxxxxx>
Date: Fri, 11 May 2007 10:34:48 -0600
Cc: xen-ia64-devel <xen-ia64-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 11 May 2007 09:38:11 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: OSLO R&D
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
   We ran into a problem on ia64 that checker doesn't support structures
containing unions.  This adds that support and changes the output format
to allow for longer structure names.  We've got both unions and a long
struct name in the ia64 tree, so these changes will get used next time
we merge.  Thanks,

        Alex

Signed-off-by: Alex Williamson <alex.williamson@xxxxxx>
---

diff -r 22c5695b7c73 xen/include/public/foreign/mkchecker.py
--- a/xen/include/public/foreign/mkchecker.py   Fri May 11 10:07:06 2007 +0100
+++ b/xen/include/public/foreign/mkchecker.py   Fri May 11 10:23:36 2007 -0600
@@ -29,14 +29,14 @@ f.write('int main(int argc, char *argv[]
 f.write('int main(int argc, char *argv[])\n{\n');
 
 f.write('\tprintf("\\n");');
-f.write('printf("%-20s |", "structs");\n');
+f.write('printf("%-25s |", "structs");\n');
 for a in archs:
     f.write('\tprintf("%%8s", "%s");\n' % a);
 f.write('\tprintf("\\n");');
 
 f.write('\tprintf("\\n");');
 for struct in structs:
-    f.write('\tprintf("%%-20s |", "%s");\n' % struct);
+    f.write('\tprintf("%%-25s |", "%s");\n' % struct);
     for a in archs:
         if a == arch:
             s = struct; # native
diff -r 22c5695b7c73 xen/include/public/foreign/mkheader.py
--- a/xen/include/public/foreign/mkheader.py    Fri May 11 10:07:06 2007 +0100
+++ b/xen/include/public/foreign/mkheader.py    Fri May 11 10:21:26 2007 -0600
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 
 import sys, re;
-from structs import structs, defines;
+from structs import unions, structs, defines;
 
 # command line arguments
 arch    = sys.argv[1];
@@ -110,6 +110,16 @@ input = re.compile("/\*(.*?)\*/", re.S).
 input = re.compile("/\*(.*?)\*/", re.S).sub("", input)
 input = re.compile("\n\s*\n", re.S).sub("\n", input);
 
+# add unions to output
+for union in unions:
+    regex = "union\s+%s\s*\{(.*?)\n\};" % union;
+    match = re.search(regex, input, re.S)
+    if None == match:
+        output += "#define %s_has_no_%s 1\n" % (arch, union);
+    else:
+        output += "union %s_%s {%s\n};\n" % (union, arch, match.group(1));
+    output += "\n";
+
 # add structs to output
 for struct in structs:
     regex = "struct\s+%s\s*\{(.*?)\n\};" % struct;
@@ -135,6 +145,10 @@ for define in defines:
         replace = define + "_" + arch;
     output = re.sub("\\b%s\\b" % define, replace, output);
 
+# replace: unions
+for union in unions:
+    output = re.sub("\\b(union\s+%s)\\b" % union, "\\1_%s" % arch, output);
+
 # replace: structs + struct typedefs
 for struct in structs:
     output = re.sub("\\b(struct\s+%s)\\b" % struct, "\\1_%s" % arch, output);
diff -r 22c5695b7c73 xen/include/public/foreign/reference.size
--- a/xen/include/public/foreign/reference.size Fri May 11 10:07:06 2007 +0100
+++ b/xen/include/public/foreign/reference.size Fri May 11 10:25:48 2007 -0600
@@ -1,17 +1,17 @@
 
-structs              |  x86_32  x86_64    ia64
+structs                   |  x86_32  x86_64    ia64
 
-start_info           |    1104    1152    1152
-trap_info            |       8      16       -
-pt_fpreg             |       -       -      16
-cpu_user_regs        |      68     200     496
-xen_ia64_boot_param  |       -       -      96
-ia64_tr_entry        |       -       -      32
-vcpu_extra_regs      |       -       -     536
-vcpu_guest_context   |    2800    5168    1056
-arch_vcpu_info       |      24      16       0
-vcpu_time_info       |      32      32      32
-vcpu_info            |      64      64      48
-arch_shared_info     |     268     280     272
-shared_info          |    2584    3368    4384
+start_info                |    1104    1152    1152
+trap_info                 |       8      16       -
+pt_fpreg                  |       -       -      16
+cpu_user_regs             |      68     200     496
+xen_ia64_boot_param       |       -       -      96
+ia64_tr_entry             |       -       -      32
+vcpu_extra_regs           |       -       -     536
+vcpu_guest_context        |    2800    5168    1056
+arch_vcpu_info            |      24      16       0
+vcpu_time_info            |      32      32      32
+vcpu_info                 |      64      64      48
+arch_shared_info          |     268     280     272
+shared_info               |    2584    3368    4384
 
diff -r 22c5695b7c73 xen/include/public/foreign/structs.py
--- a/xen/include/public/foreign/structs.py     Fri May 11 10:07:06 2007 +0100
+++ b/xen/include/public/foreign/structs.py     Fri May 11 10:22:34 2007 -0600
@@ -1,4 +1,6 @@
 # configuration: what needs translation
+
+unions  = [ ];
 
 structs = [ "start_info",
             "trap_info",



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Allow checker to support unions, Alex Williamson <=