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-changelog

[Xen-changelog] Makefile:

ChangeSet 1.1713.1.16, 2005/06/17 10:35:26+01:00, cl349@xxxxxxxxxxxxxxxxxxxx

        Makefile:
          Add xs_dom0_test program to test IOCTL_PRIVCMD_INITDOMAIN_STORE.
        xs_dom0_test.c:
          new file
        From: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
        Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>



 Makefile       |    9 ++++++---
 xs_dom0_test.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 3 deletions(-)


diff -Nru a/tools/xenstore/Makefile b/tools/xenstore/Makefile
--- a/tools/xenstore/Makefile   2005-06-17 21:03:04 -04:00
+++ b/tools/xenstore/Makefile   2005-06-17 21:03:04 -04:00
@@ -27,7 +27,7 @@
 
 all: xen xenstored libxenstore.a libxenstore-pic.a
 
-testcode: xen xs_test xenstored_test xs_random
+testcode: xen xs_test xenstored_test xs_random xs_dom0_test
 
 xen:
        ln -sf $(XEN_ROOT)/xen/include/public $@
@@ -63,8 +63,8 @@
 libxenstore-pic.a: $(LIB_OBJS_PIC)
 
 clean: testsuite-clean
-       rm -f *.o *.opic *.a
-       rm -f xs_test xenstored xenstored_test xs_random xs_stress xen
+       rm -f *.o *.opic *.a xen
+       rm -f xs_test xenstored xenstored_test xs_random xs_stress xs_dom0_test
        -$(RM) $(PROG_DEP)
 
 check: testsuite-run randomcheck stresstest
@@ -86,6 +86,9 @@
 stresstest: xs_stress xenstored_test
        rm -rf $(TESTDIR)/store
        export $(TESTENV); PID=`./xenstored_test --output-pid`; ./xs_stress 
10000; ret=$$?; kill $$PID; exit $$ret
+
+xs_dom0_test: xs_dom0_test.o utils.o
+       $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxc -o $@
 
 TAGS:
        etags `find . -name '*.[ch]'`
diff -Nru a/tools/xenstore/xs_dom0_test.c b/tools/xenstore/xs_dom0_test.c
--- /dev/null   Wed Dec 31 16:00:00 196900
+++ b/tools/xenstore/xs_dom0_test.c     2005-06-17 21:03:04 -04:00
@@ -0,0 +1,43 @@
+/* Test introduction of domain 0 */
+#include <linux/ioctl.h>
+#include <sys/ioctl.h>
+#include "xs.h"
+#include "utils.h"
+#include <xc.h>
+#include <xen/linux/privcmd.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+int main()
+{
+       int h, local = 0, kernel = 0;
+       long err;
+       void *page;
+
+       h = xc_interface_open();
+       if (h < 0)
+               barf_perror("Failed to open xc");
+
+       if (xc_evtchn_bind_interdomain(h, DOMID_SELF, 0, &local, &kernel) != 0)
+               barf_perror("Failed to bind interdomain");
+
+       printf("Got ports %i & %i\n", local, kernel);
+
+       err = ioctl(h, IOCTL_PRIVCMD_INITDOMAIN_STORE, kernel);
+       if (err < 0)
+               barf_perror("Failed to initialize store");
+       printf("Got mfn %li\n", err);
+
+       page = xc_map_foreign_range(h, 0, getpagesize(), PROT_READ|PROT_WRITE,
+                                   err);
+       if (!page)
+               barf_perror("Failed to map page %li", err);
+       printf("Mapped page at %p\n", page);
+       printf("Page says %s\n", (char *)page);
+       munmap(page, getpagesize());
+       printf("unmapped\n");
+       
+       return 0;
+}
+       

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

<Prev in Thread] Current Thread [Next in Thread>