/* Live mapping of system MFN to PFN table. */
static xen_pfn_t *live_m2p = NULL;
+static unsigned long m2p_mfn0;
/* grep fodder: machine_to_phys */
** that this check will fail for other L2s.
*/
if (pt_levels == 3 && type == XEN_DOMCTL_PFINFO_L2TAB) {
-
-/* XXX index of the L2 entry in PAE mode which holds the guest LPT */
-#define PAE_GLPT_L2ENTRY (495)
- pte = ((const uint64_t*)spage)[PAE_GLPT_L2ENTRY];
-
- if(((pte >> PAGE_SHIFT) & 0x0fffffff) == live_p2m[pfn])
- xen_start = (hvirt_start >> L2_PAGETABLE_SHIFT_PAE) & 0x1ff;
+ int hstart;
+ unsigned long he;
+
+ hstart = (hvirt_start >> L2_PAGETABLE_SHIFT_PAE) & 0x1ff;
+ he = ((const uint64_t *) spage)[hstart];
+
+ if ( ((he >> PAGE_SHIFT) & 0x0fffffff) == m2p_mfn0 ) {
+ /* hvirt starts with xen stuff... */
+ xen_start = hstart;
+ } else if ( hvirt_start != 0xf5800000 ) {
+ /* old L2s from before hole was shrunk... */
+ hstart = (0xf5800000 >> L2_PAGETABLE_SHIFT_PAE) & 0x1ff;
+ he = ((const uint64_t *) spage)[hstart];
+
+ if( ((he >> PAGE_SHIFT) & 0x0fffffff) == m2p_mfn0 )
+ xen_start = hstart;
+ }
}
if (pt_levels == 4 && type == XEN_DOMCTL_PFINFO_L4TAB) {
return NULL;
}
+ m2p_mfn0 = entries[0].mfn;
+
free(extent_start);
free(entries);
*hvirt_start = xen_params.virt_start;
+ /*
+ * XXX For now, 32bit dom0's can only save/restore 32bit domUs
+ * on 64bit hypervisors, so no need to check which type of domain
+ * we're dealing with.
+ */
if (strstr(xen_caps, "xen-3.0-x86_64"))
+#if defined(__i386__)
+ *pt_levels = 3;
+#else
*pt_levels = 4;
+#endif
else if (strstr(xen_caps, "xen-3.0-x86_32p"))
*pt_levels = 3;
else if (strstr(xen_caps, "xen-3.0-x86_32"))
c.nat->ctrlreg[3] = xen_pfn_to_cr3(pagetable_get_pfn(v->arch.guest_table));
#ifdef CONFIG_COMPAT
else
- c.cmp->ctrlreg[3] = compat_pfn_to_cr3(pagetable_get_pfn(v->arch.guest_table));
+ {
+ l4_pgentry_t *l4e = __va(pagetable_get_paddr(v->arch.guest_table));
+ c.cmp->ctrlreg[3] = compat_pfn_to_cr3(l4e_get_pfn(*l4e));
+ }
#endif
c(vm_assist = v->domain->vm_assist);
#define L3_DISALLOW_MASK (BASE_DISALLOW_MASK | 0x180U /* must-be-zero */)
#define L4_DISALLOW_MASK (BASE_DISALLOW_MASK | 0x180U /* must-be-zero */)
-#define COMPAT_L3_DISALLOW_MASK 0xFFFFF1E6U /* must-be-zero */
+#define COMPAT_L3_DISALLOW_MASK L3_DISALLOW_MASK
#define PAGE_HYPERVISOR (__PAGE_HYPERVISOR | _PAGE_GLOBAL)
#define PAGE_HYPERVISOR_NOCACHE (__PAGE_HYPERVISOR_NOCACHE | _PAGE_GLOBAL)