add %esi,sym_fs(__page_tables_start)-8(,%ecx,8)
2: loop 1b
- /* Initialize L2 boot-map/direct map page table entries (16MB). */
+ /*
+ * Map Xen into the directmap (needed for early-boot pagetable
+ * handling/walking), and identity map Xen into bootmap (needed for
+ * the transition into long mode), using 2M superpages.
+ */
lea sym_esi(start),%ebx
lea (1<<L2_PAGETABLE_SHIFT)*7+(PAGE_HYPERVISOR|_PAGE_PSE)(%ebx),%eax
shr $(L2_PAGETABLE_SHIFT-3),%ebx
sub $(1<<L2_PAGETABLE_SHIFT),%eax
loop 1b
- /* Initialize L3 boot-map page directory entry. */
+ /* Initialize L3 boot-map page directory entries. */
lea __PAGE_HYPERVISOR+(L2_PAGETABLE_ENTRIES*8)*3+sym_esi(l2_bootmap),%eax
mov $4,%ecx
1: mov %eax,sym_fs(l3_bootmap)-8(,%ecx,8)
if ( !efi_enabled(EFI_LOADER) )
return;
- /* Initialise L2 identity-map and boot-map page table entries (16MB). */
+ /* Check that there is at least 4G of mapping space in l2_*map[] */
+ BUILD_BUG_ON((sizeof(l2_bootmap) / L2_PAGETABLE_ENTRIES) < 4);
+ BUILD_BUG_ON((sizeof(l2_identmap) / L2_PAGETABLE_ENTRIES) < 4);
+
+ /* Initialize L3 boot-map page directory entries. */
+ for ( i = 0; i < 4; ++i )
+ l3_bootmap[i] = l3e_from_paddr((UINTN)l2_bootmap + i * PAGE_SIZE,
+ __PAGE_HYPERVISOR);
+ /*
+ * Map Xen into the directmap (needed for early-boot pagetable
+ * handling/walking), and identity map Xen into bootmap (needed for the
+ * transition from the EFI pagetables to Xen), using 2M superpages.
+ */
for ( i = 0; i < 8; ++i )
{
unsigned int slot = (xen_phys_start >> L2_PAGETABLE_SHIFT) + i;
paddr_t addr = slot << L2_PAGETABLE_SHIFT;
l2_identmap[slot] = l2e_from_paddr(addr, PAGE_HYPERVISOR|_PAGE_PSE);
- slot &= L2_PAGETABLE_ENTRIES - 1;
l2_bootmap[slot] = l2e_from_paddr(addr, __PAGE_HYPERVISOR|_PAGE_PSE);
}
- /* Initialise L3 boot-map page directory entries. */
- l3_bootmap[l3_table_offset(xen_phys_start)] =
- l3e_from_paddr((UINTN)l2_bootmap, __PAGE_HYPERVISOR);
- l3_bootmap[l3_table_offset(xen_phys_start + (8 << L2_PAGETABLE_SHIFT) - 1)] =
- l3e_from_paddr((UINTN)l2_bootmap, __PAGE_HYPERVISOR);
}
static void __init efi_arch_handle_module(struct file *file, const CHAR16 *name,
"not enough room for trampoline and mbi data")
ASSERT((wakeup_stack - wakeup_stack_start) >= WAKEUP_STACK_MIN,
"wakeup stack too small")
+
+/* Plenty of boot code assumes that Xen isn't larger than 16M. */
+ASSERT(_end - _start <= MB(16), "Xen too large for early-boot assumptions")