+#include <xen/lib.h>
#include <xen/multiboot.h>
#include <xen/multiboot2.h>
#include <public/xen.h>
.Lbad_ldr_nst: .asciz "ERR: EFI SystemTable is not provided by bootloader!"
.Lbad_ldr_nih: .asciz "ERR: EFI ImageHandle is not provided by bootloader!"
.Lbad_efi_msg: .asciz "ERR: EFI IA-32 platforms are not supported!"
+.Lbad_alg_msg: .asciz "ERR: Xen must be loaded at a 2Mb boundary!"
.section .init.data, "aw", @progbits
.align 4
not_multiboot:
mov $sym_offs(.Lbad_ldr_msg), %ecx
jmp .Lget_vtb
+.Lnot_aligned:
+ mov $sym_offs(.Lbad_alg_msg), %ecx
+ jmp .Lget_vtb
.Lmb2_no_st:
/*
* Here we are on EFI platform. vga_text_buffer was zapped earlier
cmp %edi, %eax
jb 1b
+ .if !IS_ALIGNED(sym_offs(0), 1 << L2_PAGETABLE_SHIFT)
+ .error "Symbol offset calculation breaks alignment"
+ .endif
+
+ /* Check that the image base is aligned. */
+ lea sym_esi(_start), %eax
+ test $(1 << L2_PAGETABLE_SHIFT) - 1, %eax
+ jnz .Lnot_aligned
+
/* Map Xen into the higher mappings using 2M superpages. */
lea _PAGE_PSE + PAGE_HYPERVISOR_RWX + sym_esi(_start), %eax
mov $sym_offs(_start), %ecx /* %eax = PTE to write ^ */