module_t *initrd,
char *cmdline)
{
- int i, cpu, rc, compatible, compat32, order, machine;
+ int i, cpu, rc, compatible, order, machine;
struct cpu_user_regs *regs;
unsigned long pfn, mfn;
unsigned long nr_pages;
/* compatibility check */
compatible = 0;
- compat32 = 0;
machine = elf_uval(&elf, elf.ehdr, e_machine);
printk(" Xen kernel: 64-bit, lsb, compat32\n");
if ( elf_32bit(&elf) && parms.pae == XEN_PAE_BIMODAL )
parms.pae = XEN_PAE_EXTCR3;
if ( elf_32bit(&elf) && parms.pae && machine == EM_386 )
{
- compat32 = 1;
+ if ( unlikely(rc = switch_compat(d)) )
+ {
+ printk("Dom0 failed to switch to compat: %d\n", rc);
+ return rc;
+ }
+
compatible = 1;
}
if (elf_64bit(&elf) && machine == EM_X86_64)
}
}
- if ( compat32 )
- {
- d->arch.is_32bit_pv = d->arch.has_32bit_shinfo = 1;
- d->arch.pv.xpti = false;
- d->arch.pv.pcid = false;
- v->vcpu_info = (void *)&d->shared_info->compat.vcpu_info[0];
- if ( setup_compat_arg_xlat(v) != 0 )
- BUG();
- }
-
nr_pages = dom0_compute_nr_pages(d, &parms, initrd_len);
if ( parms.pae == XEN_PAE_EXTCR3 )
parms.p2m_base = UNSET_ADDR;
}
- domain_set_alloc_bitsize(d);
-
/*
* Why do we need this? The number of page-table frames depends on the
* size of the bootstrap address space. But the size of the address space
{
maddr_to_page(mpt_alloc)->u.inuse.type_info = PGT_l4_page_table;
l4start = l4tab = __va(mpt_alloc); mpt_alloc += PAGE_SIZE;
+ clear_page(l4tab);
+ init_xen_l4_slots(l4tab, _mfn(virt_to_mfn(l4start)),
+ d, INVALID_MFN, true);
+ v->arch.guest_table = pagetable_from_paddr(__pa(l4start));
}
else
{
- page = alloc_domheap_page(d, MEMF_no_owner | MEMF_no_scrub);
- if ( !page )
- panic("Not enough RAM for domain 0 PML4\n");
- page->u.inuse.type_info = PGT_l4_page_table|PGT_validated|1;
- l4start = l4tab = page_to_virt(page);
+ /* Monitor table already created by switch_compat(). */
+ l4start = l4tab = __va(pagetable_get_paddr(v->arch.guest_table));
+ /* See public/xen.h on why the following is needed. */
maddr_to_page(mpt_alloc)->u.inuse.type_info = PGT_l3_page_table;
l3start = __va(mpt_alloc); mpt_alloc += PAGE_SIZE;
}
- clear_page(l4tab);
- init_xen_l4_slots(l4tab, _mfn(virt_to_mfn(l4start)),
- d, INVALID_MFN, true);
- v->arch.guest_table = pagetable_from_paddr(__pa(l4start));
- if ( is_pv_32bit_domain(d) )
- v->arch.guest_table_user = v->arch.guest_table;
l4tab += l4_table_offset(v_start);
pfn = alloc_spfn;