Rusty Russell
2005-May-31 10:47 UTC
[Xen-devel] [PATCH] Store page and evtchn in start_info_t
Hi all, This is a trivial patch which adds the two fields to start_info_t for the shared page and event channel port for the share. Feel free to destroy this in any way. The python binding just fills zeros in for the moment, making it harmless. Mike Wray has a nicer version in his tree, but this is the minimal version. (Thanks to Mike for the .esp fix, too). Cheers, Rusty. diff -ur xen-unstable/tools/libxc/xc.h xen-unstable-working/tools/libxc/xc.h --- xen-unstable/tools/libxc/xc.h 2005-05-31 15:39:52.000000000 +1000 +++ xen-unstable-working/tools/libxc/xc.h 2005-05-31 17:36:49.000000000 +1000 @@ -252,7 +252,9 @@ const char *cmdline, unsigned int control_evtchn, unsigned long flags, - unsigned int vcpus); + unsigned int vcpus, + unsigned int store_evtchn, + unsigned long *store_mfn); int xc_plan9_build (int xc_handle, diff -ur xen-unstable/tools/libxc/xc_linux_build.c xen-unstable-working/tools/libxc/xc_linux_build.c --- xen-unstable/tools/libxc/xc_linux_build.c 2005-05-24 13:10:24.000000000 +1000 +++ xen-unstable-working/tools/libxc/xc_linux_build.c 2005-05-31 17:44:08.000000000 +1000 @@ -50,7 +50,8 @@ unsigned long shared_info_frame, unsigned int control_evtchn, unsigned long flags, - unsigned int vcpus) + unsigned int vcpus, + unsigned int store_evtchn, unsigned long *store_mfn) { l1_pgentry_t *vl1tab=NULL, *vl1e=NULL; l2_pgentry_t *vl2tab=NULL, *vl2e=NULL; @@ -108,7 +109,8 @@ { vpt_end = vpt_start + (nr_pt_pages * PAGE_SIZE); vstartinfo_start = vpt_end; - vstartinfo_end = vstartinfo_start + PAGE_SIZE; + /* Place store shared page after startinfo. */ + vstartinfo_end = vstartinfo_start + PAGE_SIZE * 2; vstack_start = vstartinfo_end; vstack_end = vstack_start + PAGE_SIZE; v_end = (vstack_end + (1<<22)-1) & ~((1<<22)-1); @@ -125,13 +127,15 @@ " Phys-Mach map: %08lx->%08lx\n" " Page tables: %08lx->%08lx\n" " Start info: %08lx->%08lx\n" + " Store page: %08lx->%08lx\n" " Boot stack: %08lx->%08lx\n" " TOTAL: %08lx->%08lx\n", dsi.v_kernstart, dsi.v_kernend, vinitrd_start, vinitrd_end, vphysmap_start, vphysmap_end, vpt_start, vpt_end, - vstartinfo_start, vstartinfo_end, + vstartinfo_start, vstartinfo_start + PAGE_SIZE, + vstartinfo_start + PAGE_SIZE, vstartinfo_end, vstack_start, vstack_end, dsi.v_start, v_end); printf(" ENTRY ADDRESS: %08lx\n", dsi.v_kernentry); @@ -261,6 +265,8 @@ start_info->nr_pt_frames = nr_pt_pages; start_info->mfn_list = vphysmap_start; start_info->domain_controller_evtchn = control_evtchn; + start_info->store_page = vstartinfo_start + PAGE_SIZE; + start_info->store_evtchn = store_evtchn; if ( initrd_len != 0 ) { start_info->mod_start = vinitrd_start; @@ -270,6 +276,9 @@ start_info->cmd_line[MAX_CMDLINE-1] = ''\0''; munmap(start_info, PAGE_SIZE); + /* Tell our caller where we told domain store page was. */ + *store_mfn = page_array[((vstartinfo_start-dsi.v_start)>>PAGE_SHIFT) + 1]; + /* shared_info page starts its life empty. */ shared_info = xc_map_foreign_range( xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, shared_info_frame); @@ -310,7 +319,9 @@ const char *cmdline, unsigned int control_evtchn, unsigned long flags, - unsigned int vcpus) + unsigned int vcpus, + unsigned int store_evtchn, + unsigned long *store_mfn) { dom0_op_t launch_op, op; int initrd_fd = -1; @@ -381,7 +392,8 @@ &vstartinfo_start, &vkern_entry, ctxt, cmdline, op.u.getdomaininfo.shared_info_frame, - control_evtchn, flags, vcpus) < 0 ) + control_evtchn, flags, vcpus, + store_evtchn, store_mfn) < 0 ) { ERROR("Error constructing guest OS"); goto error_out; @@ -412,7 +424,7 @@ ctxt->user_regs.ss = FLAT_KERNEL_DS; ctxt->user_regs.cs = FLAT_KERNEL_CS; ctxt->user_regs.eip = vkern_entry; - ctxt->user_regs.esp = vstartinfo_start + 2*PAGE_SIZE; + ctxt->user_regs.esp = vstartinfo_start + 3*PAGE_SIZE; ctxt->user_regs.esi = vstartinfo_start; ctxt->user_regs.eflags = 1 << 9; /* Interrupt Enable */ @@ -434,7 +446,7 @@ /* Ring 1 stack is the initial stack. */ ctxt->kernel_ss = FLAT_KERNEL_DS; - ctxt->kernel_sp = vstartinfo_start + 2*PAGE_SIZE; + ctxt->kernel_sp = vstartinfo_start + 3*PAGE_SIZE; /* No debugging. */ memset(ctxt->debugreg, 0, sizeof(ctxt->debugreg)); diff -ur xen-unstable/tools/python/xen/lowlevel/xc/xc.c xen-unstable-working/tools/python/xen/lowlevel/xc/xc.c --- xen-unstable/tools/python/xen/lowlevel/xc/xc.c 2005-05-31 15:39:54.000000000 +1000 +++ xen-unstable-working/tools/python/xen/lowlevel/xc/xc.c 2005-05-31 17:40:12.000000000 +1000 @@ -261,7 +261,8 @@ u32 dom; char *image, *ramdisk = NULL, *cmdline = ""; - int control_evtchn, flags = 0, vcpus = 1; + int control_evtchn, store_evtchn = 0, flags = 0, vcpus = 1; + unsigned long store_mfn; static char *kwd_list[] = { "dom", "control_evtchn", "image", "ramdisk", "cmdline", "flags", "vcpus", @@ -272,8 +273,10 @@ &image, &ramdisk, &cmdline, &flags, &vcpus) ) return NULL; + /* FIXME: Integrate store_mfn and store_evtchn into python callers. */ if ( xc_linux_build(xc->xc_handle, dom, image, - ramdisk, cmdline, control_evtchn, flags, vcpus) != 0 ) + ramdisk, cmdline, control_evtchn, flags, vcpus, + store_evtchn, &store_mfn) != 0 ) return PyErr_SetFromErrno(xc_error); Py_INCREF(zero); diff -ur xen-unstable/xen/include/public/xen.h xen-unstable-working/xen/include/public/xen.h --- xen-unstable/xen/include/public/xen.h 2005-05-24 13:10:17.000000000 +1000 +++ xen-unstable-working/xen/include/public/xen.h 2005-05-31 17:36:49.000000000 +1000 @@ -461,7 +461,10 @@ memory_t mod_len; /* 56: Size (bytes) of pre-loaded module. */ _MEMORY_PADDING(G); s8 cmd_line[MAX_CMDLINE]; /* 64 */ -} PACKED start_info_t; /* 320 bytes */ + memory_t store_page; /* 320: VIRTUAL address of store ringbuffer page. */ + _MEMORY_PADDING(H); + u16 store_evtchn; /* 328: Event channel for store communication. */ +} PACKED start_info_t; /* 332/336 bytes */ /* These flags are passed in the ''flags'' field of start_info_t. */ #define SIF_PRIVILEGED (1<<0) /* Is the domain privileged? */ -- A bad analogy is like a leaky screwdriver -- Richard Braakman _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Possibly Parallel Threads
- Re: [Xen-changelog] New console transport and update xenconsoled.
- [PATCH]mini-os: handle start_info_t pointer
- [PATCH RFC] add domain builder support for bzImage kernels
- [PATCH RFC] add domain builder support for bzImage kernels
- [PATCH RFC] add domain builder support for bzImage kernels