Mailing List Archive

Re-arrange things in the domain builder a bit so as to make sure that
# HG changeset patch
# User sos22@douglas.cl.cam.ac.uk
# Node ID 6411e42ae4973719fb6b48740e9f267e6b3fa808
# Parent 4cce50ba45208ff31c2addfe0a9a0ef9083e64a0
Re-arrange things in the domain builder a bit so as to make sure that
when we make a page below 4G in the domain, that gets reflected into
the M2P and P2M tables.

Signed-off-by: Steven Smith, sos22@cam.ac.uk

diff -r 4cce50ba4520 -r 6411e42ae497 tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c Sun Jan 29 09:55:28 2006
+++ b/tools/libxc/xc_linux_build.c Mon Jan 30 11:53:33 2006
@@ -654,72 +654,6 @@
}
}

- if ( (mmu = xc_init_mmu_updates(xc_handle, dom)) == NULL )
- goto error_out;
-
- /* Write the phys->machine and machine->phys table entries. */
- physmap_pfn = (vphysmap_start - dsi.v_start) >> PAGE_SHIFT;
- physmap = physmap_e = xc_map_foreign_range(
- xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE,
- page_array[physmap_pfn++]);
-
- for ( count = 0; count < nr_pages; count++ )
- {
- if ( xc_add_mmu_update(
- xc_handle, mmu,
- ((uint64_t)page_array[count] << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE,
- count) )
- {
- fprintf(stderr,"m2p update failure p=%lx m=%lx\n",
- count, page_array[count]);
- munmap(physmap, PAGE_SIZE);
- goto error_out;
- }
- *physmap_e++ = page_array[count];
- if ( ((unsigned long)physmap_e & (PAGE_SIZE-1)) == 0 )
- {
- munmap(physmap, PAGE_SIZE);
- physmap = physmap_e = xc_map_foreign_range(
- xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE,
- page_array[physmap_pfn++]);
- }
- }
- munmap(physmap, PAGE_SIZE);
-
- /* Send the page update requests down to the hypervisor. */
- if ( xc_finish_mmu_updates(xc_handle, mmu) )
- goto error_out;
-
- if ( shadow_mode_enabled )
- {
- struct xen_reserved_phys_area xrpa;
-
- /* Enable shadow translate mode */
- if ( xc_shadow_control(xc_handle, dom,
- DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE,
- NULL, 0, NULL) < 0 )
- {
- PERROR("Could not enable translation mode");
- goto error_out;
- }
-
- /* Find the shared info frame. It's guaranteed to be at the
- start of the PFN hole. */
- xrpa.domid = dom;
- xrpa.idx = 0;
- rc = xc_memory_op(xc_handle, XENMEM_reserved_phys_area, &xrpa);
- if ( rc != 0 )
- {
- PERROR("Cannot find shared info pfn");
- goto error_out;
- }
- guest_shared_info_mfn = xrpa.first_pfn;
- }
- else
- {
- guest_shared_info_mfn = shared_info_frame;
- }
-
/* setup page tables */
#if defined(__i386__)
if (dsi.pae_kernel)
@@ -773,6 +707,72 @@
ctxt->ctrlreg[3] >> PAGE_SHIFT, dom) )
goto error_out;
#endif
+
+ if ( (mmu = xc_init_mmu_updates(xc_handle, dom)) == NULL )
+ goto error_out;
+
+ /* Write the phys->machine and machine->phys table entries. */
+ physmap_pfn = (vphysmap_start - dsi.v_start) >> PAGE_SHIFT;
+ physmap = physmap_e = xc_map_foreign_range(
+ xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE,
+ page_array[physmap_pfn++]);
+
+ for ( count = 0; count < nr_pages; count++ )
+ {
+ if ( xc_add_mmu_update(
+ xc_handle, mmu,
+ ((uint64_t)page_array[count] << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE,
+ count) )
+ {
+ fprintf(stderr,"m2p update failure p=%lx m=%lx\n",
+ count, page_array[count]);
+ munmap(physmap, PAGE_SIZE);
+ goto error_out;
+ }
+ *physmap_e++ = page_array[count];
+ if ( ((unsigned long)physmap_e & (PAGE_SIZE-1)) == 0 )
+ {
+ munmap(physmap, PAGE_SIZE);
+ physmap = physmap_e = xc_map_foreign_range(
+ xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE,
+ page_array[physmap_pfn++]);
+ }
+ }
+ munmap(physmap, PAGE_SIZE);
+
+ /* Send the page update requests down to the hypervisor. */
+ if ( xc_finish_mmu_updates(xc_handle, mmu) )
+ goto error_out;
+
+ if ( shadow_mode_enabled )
+ {
+ struct xen_reserved_phys_area xrpa;
+
+ /* Enable shadow translate mode */
+ if ( xc_shadow_control(xc_handle, dom,
+ DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE,
+ NULL, 0, NULL) < 0 )
+ {
+ PERROR("Could not enable translation mode");
+ goto error_out;
+ }
+
+ /* Find the shared info frame. It's guaranteed to be at the
+ start of the PFN hole. */
+ xrpa.domid = dom;
+ xrpa.idx = 0;
+ rc = xc_memory_op(xc_handle, XENMEM_reserved_phys_area, &xrpa);
+ if ( rc != 0 )
+ {
+ PERROR("Cannot find shared info pfn");
+ goto error_out;
+ }
+ guest_shared_info_mfn = xrpa.first_pfn;
+ }
+ else
+ {
+ guest_shared_info_mfn = shared_info_frame;
+ }

*store_mfn = page_array[(vstoreinfo_start-dsi.v_start) >> PAGE_SHIFT];
*console_mfn = page_array[(vconsole_start-dsi.v_start) >> PAGE_SHIFT];

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