bitkeeper revision 1.1159.258.19 (42273652yPWGOWH6C8w45TOchk7Jog)
authorrminnich@lanl.gov[iap10] <rminnich@lanl.gov[iap10]>
Thu, 3 Mar 2005 16:07:46 +0000 (16:07 +0000)
committerrminnich@lanl.gov[iap10] <rminnich@lanl.gov[iap10]>
Thu, 3 Mar 2005 16:07:46 +0000 (16:07 +0000)
This patch enables argument passing to plan 9 domains, so that users can
now have parameters for things like Venti etc.

Signed-off-by: ron minnich <rminnich@lanl.gov>
Signed-off-by: ian.pratt@cl.cam.ac.uk
BitKeeper/etc/logging_ok
tools/libxc/xc_plan9_build.c

index 44556798fe849ddcf3fe3cd5b792abefeeaf030f..d1c20d6e5f0e9b1e62449fcdee828ad46e2c0f27 100644 (file)
@@ -46,6 +46,7 @@ mwilli2@equilibrium.research.intel-research.net
 mwilli2@pug.(none)
 rac61@labyrinth.cl.cam.ac.uk
 rgr22@boulderdash.cl.cam.ac.uk
+rminnich@lanl.gov
 rn@wyvis.camb.intel-research.net
 rn@wyvis.research.intel-research.net
 rneugeba@wyvis.research
index 33c9a54914c1a6be0523639279e9ae3323c1a234..fc67a293eafcffd9b965f5f9c1da3a75f087db74 100755 (executable)
@@ -125,7 +125,8 @@ static int
             unsigned long tot_pages, unsigned long *virt_load_addr,
             unsigned long *ksize, unsigned long *symtab_addr,
             unsigned long *symtab_len,
-            unsigned long *first_data_page, unsigned long *pdb_page);
+            unsigned long *first_data_page, unsigned long *pdb_page, 
+            const char *cmdline);
 
 #define P9ROUND (P9SIZE / 8)
 
@@ -230,7 +231,7 @@ setup_guestos(int xc_handle,
 
        if (loadp9image(kernel_gfd, xc_handle, dom, cpage_array, tot_pages,
                        virt_load_addr, &ksize, &symtab_addr, &symtab_len,
-                       &first_data_page, &first_page_after_kernel))
+                       &first_data_page, &first_page_after_kernel, cmdline))
                goto error_out;
        DPRINTF(("First data page is 0x%lx\n", first_data_page));
        DPRINTF(("First page after kernel is 0x%lx\n",
@@ -623,7 +624,7 @@ xc_plan9_build(int xc_handle,
  * Plan 9 memory layout (initial)
  * ----------------
  * | info from xen| @0
- * ----------------
+ * ---------------|<--- boot args (start at 0x1200 + 64)
  * | stack        |
  * ----------------<--- page 2
  * | empty        |
@@ -658,7 +659,8 @@ loadp9image(gzFile kernel_gfd, int xc_handle, u32 dom,
            unsigned long tot_pages, unsigned long *virt_load_addr,
            unsigned long *ksize, unsigned long *symtab_addr,
            unsigned long *symtab_len,
-           unsigned long *first_data_page, unsigned long *pdb_page)
+           unsigned long *first_data_page, unsigned long *pdb_page, 
+           const char *cmdline)
 {
        unsigned long datapage;
        Exec ehdr;
@@ -669,6 +671,7 @@ loadp9image(gzFile kernel_gfd, int xc_handle, u32 dom,
        PAGE *image = 0;
        unsigned long image_tot_pages = 0;
        unsigned long textround;
+       static PAGE args;
 
        ret = -1;
 
@@ -736,6 +739,16 @@ loadp9image(gzFile kernel_gfd, int xc_handle, u32 dom,
                             image, image_tot_pages * 4096, page_array, 0x100);
        DPRINTF(("done copying kernel to guest memory\n"));
 
+       /* now do the bootargs */
+       /* in plan 9, the x=y bootargs start at 0x1200 + 64 in real memory */
+       /* we'll copy to page 1, so we offset into the page struct at 
+        * 0x200 + 64 
+        */
+       memset(&args, 0, sizeof(args));
+       memcpy(&args.data[0x200 + 64], cmdline, strlen(cmdline));
+       printf("Copied :%s: to page for args\n", cmdline);
+       ret = memcpy_toguest(xc_handle, dom, &args, sizeof(args), page_array,1);
+       dumpit(xc_handle, dom, 0 /*0x100000>>12*/, 4, page_array) ;
       out:
        if (image)
                free(image);