[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [patch rfc 3/3] xen arch header rework, check utility.



This adds a tiny utility to verify the patch is correct, by printing the
sizes of the structures.  Compile once on 32bit and once on 64bit,
compare the results, it they don't match something is wrong ...

Signed-off-by: Gerd Hoffmann <kraxel@xxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 tools/xcutils/Makefile        |    1 +
 tools/xcutils/check-structs.c |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

Index: build-64-unstable-11624/tools/xcutils/Makefile
===================================================================
--- build-64-unstable-11624.orig/tools/xcutils/Makefile
+++ build-64-unstable-11624/tools/xcutils/Makefile
@@ -27,6 +27,7 @@ CFLAGS += -Wp,-MD,.$(@F).d
 PROG_DEP = .*.d
 
 PROGRAMS               = xc_restore xc_save readnotes
+PROGRAMS               += check-structs
 
 LDLIBS                 = -L$(XEN_LIBXC) -lxenguest -lxenctrl
 
Index: build-64-unstable-11624/tools/xcutils/check-structs.c
===================================================================
--- /dev/null
+++ build-64-unstable-11624/tools/xcutils/check-structs.c
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <xenctrl.h>
+#include <xen/arch-x86_32.h>
+#include <xen/arch-x86_64.h>
+
+int main(int argc, char *argv[])
+{
+       printf("%-20s %-6s %-6s\n", "struct", "x86_32", "x86_64");
+       printf("----------------------------------\n");
+       printf("%-20s %6zd %6zd\n", "trap_info_t",
+              sizeof(trap_info_x86_32_t),
+              sizeof(trap_info_x86_64_t));
+       printf("%-20s %6zd %6zd\n", "cpu_user_regs_t",
+              sizeof(cpu_user_regs_x86_32_t),
+              sizeof(cpu_user_regs_x86_64_t));
+       printf("%-20s %6zd %6zd\n", "vcpu_guest_context_t",
+              sizeof(vcpu_guest_context_x86_32_t),
+              sizeof(vcpu_guest_context_x86_64_t));
+       printf("%-20s %6zd %6zd\n", "arch_shared_info_t",
+              sizeof(arch_shared_info_x86_32_t),
+              sizeof(arch_shared_info_x86_64_t));
+       printf("%-20s %6zd %6zd\n", "arch_vcpu_info_t",
+              sizeof(arch_vcpu_info_x86_32_t),
+              sizeof(arch_vcpu_info_x86_64_t));
+       printf("%-20s %6zd %6zd\n", "xen_callback_t",
+              sizeof(xen_callback_x86_32_t),
+              sizeof(xen_callback_x86_64_t));
+       return 0;
+}

--

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.