[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 8/8] efi: drop original xen.efi code and build mechanism



Then rename xen.mb.efi to xen.efi and drop all related
differentiators in the code.

Signed-off-by: Daniel Kiper <daniel.kiper@xxxxxxxxxx>
---
 xen/Makefile                    |   16 +-
 xen/arch/arm/efi/efi-boot.h     |    4 -
 xen/arch/x86/Makefile           |   87 +--------
 xen/arch/x86/boot/head.S        |    2 +-
 xen/arch/x86/efi/Makefile       |   17 +-
 xen/arch/x86/efi/buildid.ihex   |    3 -
 xen/arch/x86/efi/check.c        |    4 -
 xen/arch/x86/efi/efi-boot.h     |   88 +--------
 xen/arch/x86/efi/mkreloc.c      |  384 ---------------------------------------
 xen/arch/x86/efi/relocs-dummy.S |   11 --
 xen/arch/x86/efi/stub.c         |   97 ----------
 xen/arch/x86/xen.lds.S          |   81 +--------
 xen/common/efi/boot.c           |    2 -
 xen/common/version.c            |   51 ------
 xen/include/xen/efi.h           |    1 -
 15 files changed, 21 insertions(+), 827 deletions(-)
 delete mode 100644 xen/arch/x86/efi/buildid.ihex
 delete mode 100644 xen/arch/x86/efi/check.c
 delete mode 100644 xen/arch/x86/efi/mkreloc.c
 delete mode 100644 xen/arch/x86/efi/relocs-dummy.S
 delete mode 100644 xen/arch/x86/efi/stub.c

diff --git a/xen/Makefile b/xen/Makefile
index a49b9b7..0c03914 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -61,20 +61,17 @@ _install: $(TARGET)$(CONFIG_XEN_INSTALL_SUFFIX)
        ln -f -s $(T)-$(XEN_FULLVERSION)$(Z) 
$(D)$(BOOT_DIR)/$(T)-$(XEN_VERSION).$(XEN_SUBVERSION)$(Z)
        ln -f -s $(T)-$(XEN_FULLVERSION)$(Z) 
$(D)$(BOOT_DIR)/$(T)-$(XEN_VERSION)$(Z)
        ln -f -s $(T)-$(XEN_FULLVERSION)$(Z) $(D)$(BOOT_DIR)/$(T)$(Z)
-       $(INSTALL_DATA) $(TARGET).mb.efi 
$(D)$(BOOT_DIR)/$(T)-$(XEN_FULLVERSION).mb.efi
-       ln -f -s $(T)-$(XEN_FULLVERSION).mb.efi 
$(D)$(BOOT_DIR)/$(T)-$(XEN_VERSION).$(XEN_SUBVERSION).mb.efi
-       ln -f -s $(T)-$(XEN_FULLVERSION).mb.efi 
$(D)$(BOOT_DIR)/$(T)-$(XEN_VERSION).mb.efi
-       ln -f -s $(T)-$(XEN_FULLVERSION).mb.efi $(D)$(BOOT_DIR)/$(T).mb.efi
+       $(INSTALL_DATA) $(TARGET).efi 
$(D)$(BOOT_DIR)/$(T)-$(XEN_FULLVERSION).efi
+       ln -f -s $(T)-$(XEN_FULLVERSION).efi 
$(D)$(BOOT_DIR)/$(T)-$(XEN_VERSION).$(XEN_SUBVERSION).efi
+       ln -f -s $(T)-$(XEN_FULLVERSION).efi 
$(D)$(BOOT_DIR)/$(T)-$(XEN_VERSION).efi
+       ln -f -s $(T)-$(XEN_FULLVERSION).efi $(D)$(BOOT_DIR)/$(T).efi
        [ -d "$(D)$(DEBUG_DIR)" ] || $(INSTALL_DIR) $(D)$(DEBUG_DIR)
        $(INSTALL_DATA) $(TARGET)-syms 
$(D)$(DEBUG_DIR)/$(T)-syms-$(XEN_FULLVERSION)
        $(INSTALL_DATA) $(TARGET)-syms.map 
$(D)$(DEBUG_DIR)/$(T)-syms-$(XEN_FULLVERSION).map
        $(INSTALL_DATA) $(KCONFIG_CONFIG) 
$(D)$(BOOT_DIR)/$(T)-$(XEN_FULLVERSION).config
-       if [ -r $(TARGET).efi -a -n '$(EFI_DIR)' ]; then \
+       if [ -n '$(EFI_DIR)' ]; then \
                [ -d $(D)$(EFI_DIR) ] || $(INSTALL_DIR) $(D)$(EFI_DIR); \
                $(INSTALL_DATA) $(TARGET).efi 
$(D)$(EFI_DIR)/$(T)-$(XEN_FULLVERSION).efi; \
-               if [ -e $(TARGET).efi.map ]; then \
-                       $(INSTALL_DATA) $(TARGET).efi.map 
$(D)$(DEBUG_DIR)/$(T)-$(XEN_FULLVERSION).efi.map; \
-               fi; \
                ln -sf $(T)-$(XEN_FULLVERSION).efi 
$(D)$(EFI_DIR)/$(T)-$(XEN_VERSION).$(XEN_SUBVERSION).efi; \
                ln -sf $(T)-$(XEN_FULLVERSION).efi 
$(D)$(EFI_DIR)/$(T)-$(XEN_VERSION).efi; \
                ln -sf $(T)-$(XEN_FULLVERSION).efi $(D)$(EFI_DIR)/$(T).efi; \
@@ -103,7 +100,6 @@ _uninstall:
        rm -f $(D)$(DEBUG_DIR)/$(T)-syms-$(XEN_FULLVERSION).map
        rm -f $(D)$(EFI_DIR)/$(T)-$(XEN_FULLVERSION).efi
        rm -f $(D)$(EFI_DIR)/$(T)-$(XEN_VERSION).$(XEN_SUBVERSION).efi
-       rm -f $(D)$(DEBUG_DIR)/$(T)-$(XEN_FULLVERSION).efi.map
        rm -f $(D)$(EFI_DIR)/$(T)-$(XEN_VERSION).efi
        rm -f $(D)$(EFI_DIR)/$(T).efi
        rm -f 
$(D)$(EFI_MOUNTPOINT)/efi/$(EFI_VENDOR)/$(T)-$(XEN_FULLVERSION).efi
@@ -125,7 +121,7 @@ _clean: delete-unfresh-files
        $(MAKE) -f $(BASEDIR)/Rules.mk -C test clean
        $(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) 
SRCARCH=$(SRCARCH) clean
        find . \( -name "*.o" -o -name ".*.d" -o -name "*.gcno" \) -exec rm -f 
{} \;
-       rm -f include/asm $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET).mb.efi 
$(TARGET).efi.map $(TARGET)-syms $(TARGET)-syms.map *~ core
+       rm -f include/asm $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET)-syms 
$(TARGET)-syms.map *~ core
        rm -f include/asm-*/asm-offsets.h
        rm -f .banner
 
diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
index ca655ff..0495150 100644
--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -341,10 +341,6 @@ static void __init *fdt_increase_size(struct file 
*fdtfile, int add_size)
     return new_fdt;
 }
 
-static void __init efi_arch_relocate_image(unsigned long delta)
-{
-}
-
 static void __init efi_arch_process_memory_map(EFI_SYSTEM_TABLE *SystemTable,
                                                void *map,
                                                UINTN map_size,
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index ef3fb51..92c38fe 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -74,10 +74,6 @@ obj-y += xstate.o
 
 x86_emulate.o: x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h
 
-efi-y := $(shell if [ ! -r $(BASEDIR)/include/xen/compile.h -o \
-                      -O $(BASEDIR)/include/xen/compile.h ]; then \
-                         echo '$(TARGET).efi'; fi)
-
 ifneq ($(build_id_linker),)
 notes_phdrs = --notes
 else
@@ -98,12 +94,12 @@ endif
 syms-warn-dup-y := --warn-dup
 syms-warn-dup-$(CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNINGS) :=
 
-$(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
+$(TARGET): $(TARGET)-syms boot/mkelf32
        ./boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TARGET) 
$(XEN_IMG_OFFSET) \
                       `$(NM) $(TARGET)-syms | sed -ne 's/^\([^ ]*\) . 
__2M_rwdata_end$$/0x\1/p'`
        $(OBJCOPY) -O binary -S --change-section-address \
                ".efi.pe.header-`$(NM) $(TARGET)-syms | sed -ne 's/^\([^ ]*\) . 
__image_base__$$/0x\1/p'`" \
-               $(TARGET)-syms $(TARGET).mb.efi
+               $(TARGET)-syms $(TARGET).efi
 
 ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o 
$(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS)
 
@@ -112,21 +108,12 @@ ifeq ($(CONFIG_LTO),y)
 prelink_lto.o: $(ALL_OBJS)
        $(LD_LTO) -r -o $@ $^
 
-prelink-efi_lto.o: $(ALL_OBJS) efi/runtime.o efi/compat.o
-       $(guard) $(LD_LTO) -r -o $@ $(filter-out %/efi/built_in.o,$^)
-
 # Link it with all the binary objects
 prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o
        $(LD) $(LDFLAGS) -r -o $@ $^
-
-prelink-efi.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) 
prelink-efi_lto.o efi/boot.init.o
-       $(guard) $(LD) $(LDFLAGS) -r -o $@ $^
 else
 prelink.o: $(ALL_OBJS)
        $(LD) $(LDFLAGS) -r -o $@ $^
-
-prelink-efi.o: $(ALL_OBJS) efi/boot.init.o efi/runtime.o efi/compat.o
-       $(guard) $(LD) $(LDFLAGS) -r -o $@ $(filter-out %/efi/built_in.o,$^)
 endif
 
 $(BASEDIR)/common/symbols-dummy.o:
@@ -152,66 +139,6 @@ $(TARGET)-syms: prelink.o xen.lds 
$(BASEDIR)/common/symbols-dummy.o
                >$(@D)/$(@F).map
        rm -f $(@D)/.$(@F).[0-9]*
 
-note.o: $(TARGET)-syms
-       $(OBJCOPY) -O binary --only-section=.note.gnu.build-id  
$(BASEDIR)/xen-syms $@.bin
-       $(OBJCOPY) -I binary -O elf64-x86-64 -B i386:x86-64 \
-               --rename-section=.data=.note.gnu.build-id -S $@.bin $@
-       rm -f $@.bin
-
-EFI_LDFLAGS = $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=10
-EFI_LDFLAGS += --image-base=$(1) --stack=0,0 --heap=0,0 --strip-debug
-EFI_LDFLAGS += --section-alignment=0x200000 --file-alignment=0x20
-EFI_LDFLAGS += --major-image-version=$(XEN_VERSION)
-EFI_LDFLAGS += --minor-image-version=$(XEN_SUBVERSION)
-EFI_LDFLAGS += --major-os-version=2 --minor-os-version=0
-EFI_LDFLAGS += --major-subsystem-version=2 --minor-subsystem-version=0
-
-$(TARGET).efi: VIRT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A 
VIRT_START$$,,p')
-$(TARGET).efi: ALT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A 
ALT_START$$,,p')
-# Don't use $(wildcard ...) here - at least make 3.80 expands this too early!
-$(TARGET).efi: guard = $(if $(shell echo efi/dis* | grep disabled),:)
-
-ifneq ($(build_id_linker),)
-ifeq ($(call ld-ver-build-id,$(LD) $(filter -m%,$(EFI_LDFLAGS))),y)
-CFLAGS += -DBUILD_ID_EFI
-EFI_LDFLAGS += $(build_id_linker)
-note_file := efi/buildid.o
-# NB: this must be the last input in the linker call, because inputs following
-# the -b option will all be treated as being in the specified format.
-note_file_option := -b pe-x86-64 $(note_file)
-else
-note_file := note.o
-endif
-else
-note_file :=
-endif
-note_file_option ?= $(note_file)
-
-$(TARGET).efi: prelink-efi.o $(note_file) efi.lds efi/relocs-dummy.o 
$(BASEDIR)/common/symbols-dummy.o efi/mkreloc
-       $(foreach base, $(VIRT_BASE) $(ALT_BASE), \
-                 $(guard) $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< 
efi/relocs-dummy.o \
-                       $(BASEDIR)/common/symbols-dummy.o $(note_file_option) 
-o $(@D)/.$(@F).$(base).0 &&) :
-       $(guard) efi/mkreloc $(foreach base,$(VIRT_BASE) 
$(ALT_BASE),$(@D)/.$(@F).$(base).0) >$(@D)/.$(@F).0r.S
-       $(guard) $(NM) -pa --format=sysv $(@D)/.$(@F).$(VIRT_BASE).0 \
-               | $(guard) $(BASEDIR)/tools/symbols $(all_symbols) --sysv 
--sort >$(@D)/.$(@F).0s.S
-       $(guard) $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0r.o 
$(@D)/.$(@F).0s.o
-       $(foreach base, $(VIRT_BASE) $(ALT_BASE), \
-                 $(guard) $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< \
-                       $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o $(note_file_option) 
-o $(@D)/.$(@F).$(base).1 &&) :
-       $(guard) efi/mkreloc $(foreach base,$(VIRT_BASE) 
$(ALT_BASE),$(@D)/.$(@F).$(base).1) >$(@D)/.$(@F).1r.S
-       $(guard) $(NM) -pa --format=sysv $(@D)/.$(@F).$(VIRT_BASE).1 \
-               | $(guard) $(BASEDIR)/tools/symbols $(all_symbols) --sysv 
--sort >$(@D)/.$(@F).1s.S
-       $(guard) $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1r.o 
$(@D)/.$(@F).1s.o
-       $(guard) $(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T efi.lds -N $< \
-                       $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o $(note_file_option) 
-o $@
-       if $(guard) false; then rm -f $@; echo 'EFI support disabled'; \
-       else $(NM) -pa --format=sysv $(@D)/$(@F) \
-               | $(BASEDIR)/tools/symbols --xensyms --sysv --sort 
>$(@D)/$(@F).map; fi
-       rm -f $(@D)/.$(@F).[0-9]*
-
-efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.o: 
$(BASEDIR)/arch/x86/efi/built_in.o
-efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.o: ;
-
 asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
        $(CC) $(filter-out -Wa$(comma)% -flto,$(CFLAGS)) -S -o $@ $<
 
@@ -220,21 +147,11 @@ xen.lds: xen.lds.S
        sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new
        mv -f .xen.lds.d.new .xen.lds.d
 
-efi.lds: xen.lds.S
-       $(CC) -P -E -Ui386 -DEFI $(filter-out -Wa$(comma)%,$(AFLAGS)) -o $@ $<
-       sed -e 's/efi\.lds\.o:/efi\.lds:/g' <.$(@F).d >.$(@F).d.new
-       mv -f .$(@F).d.new .$(@F).d
-
 boot/mkelf32: boot/mkelf32.c
        $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
 
-efi/mkreloc: efi/mkreloc.c
-       $(HOSTCC) $(HOSTCFLAGS) -g -o $@ $<
-
 .PHONY: clean
 clean::
        rm -f asm-offsets.s *.lds boot/*.o boot/*~ boot/core boot/mkelf32
        rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d
-       rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.efi efi/disabled efi/mkreloc
        rm -f boot/cmdline.S boot/reloc.S boot/*.lnk boot/*.bin
-       rm -f note.o
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 48f1b00..578461b 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -139,7 +139,7 @@ optional_header:
         .long   __2M_rwdata_end - efi_pe_head_end    /* SizeOfCode. */
         .long   0                                    /* SizeOfInitializedData. 
*/
         .long   0                                    /* 
SizeOfUninitializedData. */
-        .long   sym_offs(efi_mb_start)               /* AddressOfEntryPoint. */
+        .long   sym_offs(efi_start)                  /* AddressOfEntryPoint. */
         .long   sym_offs(start)                      /* BaseOfCode. */
         .quad   sym_offs(__image_base__)             /* ImageBase. */
         .long   XEN_LOAD_ALIGN                       /* SectionAlignment. */
diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile
index 3be9661..61cb8f6 100644
--- a/xen/arch/x86/efi/Makefile
+++ b/xen/arch/x86/efi/Makefile
@@ -1,16 +1,5 @@
 CFLAGS += -fshort-wchar
 
-efi := y$(shell rm -f disabled)
-efi := $(if $(efi),$(shell $(CC) $(filter-out $(CFLAGS-y) .%.d,$(CFLAGS)) -c 
check.c 2>disabled && echo y))
-efi := $(if $(efi),$(shell $(LD) -mi386pep --subsystem=10 -o check.efi check.o 
2>disabled && echo y))
-efi := $(if $(efi),$(shell rm disabled)y)
-
-%.o: %.ihex
-       $(OBJCOPY) -I ihex -O binary $< $@
-
-boot.init.o: buildid.o
-
-obj-y := stub.o
-obj-$(efi) := boot.init.o compat.o relocs-dummy.o runtime.o
-extra-$(efi) += buildid.o
-nocov-$(efi) += stub.o
+obj-y += boot.init.o
+obj-y += compat.o
+obj-y += runtime.o
diff --git a/xen/arch/x86/efi/buildid.ihex b/xen/arch/x86/efi/buildid.ihex
deleted file mode 100644
index a89046d..0000000
--- a/xen/arch/x86/efi/buildid.ihex
+++ /dev/null
@@ -1,3 +0,0 @@
-:10000000648600004D8DAD57140000000000000014
-:0400100000000000EC
-:00000001FF
diff --git a/xen/arch/x86/efi/check.c b/xen/arch/x86/efi/check.c
deleted file mode 100644
index 7fedd5a..0000000
--- a/xen/arch/x86/efi/check.c
+++ /dev/null
@@ -1,4 +0,0 @@
-int __attribute__((__ms_abi__)) test(int i)
-{
-    return i;
-}
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index f8aaa37..25a82f4 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -35,75 +35,6 @@ static void __init edd_put_string(u8 *dst, size_t n, const 
char *src)
 
 extern intpte_t __page_tables_start[], __page_tables_end[];
 
-#define in_page_tables(v) ((intpte_t *)(v) >= __page_tables_start && \
-                           (intpte_t *)(v) < __page_tables_end)
-
-#define PE_BASE_RELOC_ABS      0
-#define PE_BASE_RELOC_HIGHLOW  3
-#define PE_BASE_RELOC_DIR64   10
-
-extern const struct pe_base_relocs {
-    u32 rva;
-    u32 size;
-    u16 entries[];
-} __base_relocs_start[], __base_relocs_end[];
-
-static void __init efi_arch_relocate_image(unsigned long delta)
-{
-    const struct pe_base_relocs *base_relocs;
-
-    if ( efi_enabled(EFI_MB_LOADER) )
-        return;
-
-    for ( base_relocs = __base_relocs_start; base_relocs < __base_relocs_end; )
-    {
-        unsigned int i = 0, n;
-
-        n = (base_relocs->size - sizeof(*base_relocs)) /
-            sizeof(*base_relocs->entries);
-
-        /*
-         * Relevant l{2,3}_bootmap entries get initialized explicitly in
-         * efi_arch_memory_setup(), so we must not apply relocations there.
-         * l2_identmap's first slot, otoh, should be handled normally, as
-         * efi_arch_memory_setup() won't touch it (xen_phys_start should
-         * never be zero).
-         */
-        if ( xen_phys_start + base_relocs->rva == (unsigned long)l3_bootmap ||
-             xen_phys_start + base_relocs->rva == (unsigned long)l2_bootmap )
-            i = n;
-
-        for ( ; i < n; ++i )
-        {
-            unsigned long addr = xen_phys_start + base_relocs->rva +
-                                 (base_relocs->entries[i] & 0xfff);
-
-            switch ( base_relocs->entries[i] >> 12 )
-            {
-            case PE_BASE_RELOC_ABS:
-                break;
-            case PE_BASE_RELOC_HIGHLOW:
-                if ( delta )
-                {
-                    *(u32 *)addr += delta;
-                    if ( in_page_tables(addr) )
-                        *(u32 *)addr += xen_phys_start;
-                }
-                break;
-            case PE_BASE_RELOC_DIR64:
-                if ( in_page_tables(addr) )
-                    blexit(L"Unexpected relocation type");
-                if ( delta )
-                    *(u64 *)addr += delta;
-                break;
-            default:
-                blexit(L"Unsupported relocation type");
-            }
-        }
-        base_relocs = (const void *)(base_relocs->entries + i + (i & 1));
-    }
-}
-
 extern const s32 __trampoline_rel_start[], __trampoline_rel_stop[];
 extern const s32 __trampoline_seg_start[], __trampoline_seg_stop[];
 
@@ -237,7 +168,6 @@ static void __init noreturn efi_arch_post_exit_boot(void)
 {
     u64 cr4 = XEN_MINIMAL_CR4 & ~X86_CR4_PGE, efer;
 
-    efi_arch_relocate_image(__XEN_VIRT_START - xen_phys_start);
     memcpy((void *)trampoline_phys, trampoline_start, cfg.size);
 
     /* Set system registers and transfer control. */
@@ -589,11 +519,10 @@ static void __init efi_arch_memory_setup(void)
     if ( !efi_enabled(EFI_LOADER) )
         return;
 
-    if ( efi_enabled(EFI_MB_LOADER) )
-        for ( pte = __page_tables_start; pte < __page_tables_end;
-              pte += ( pte != (intpte_t *)l2_identmap ) ? 1 : 4 * 
L2_PAGETABLE_ENTRIES )
-            if ( get_pte_flags(*pte) & _PAGE_PRESENT )
-                *pte += xen_phys_start;
+    for ( pte = __page_tables_start; pte < __page_tables_end;
+          pte += ( pte != (intpte_t *)l2_identmap ) ? 1 : 4 * 
L2_PAGETABLE_ENTRIES )
+        if ( get_pte_flags(*pte) & _PAGE_PRESENT )
+            *pte += xen_phys_start;
 
     /* Initialise L2 identity-map and boot-map page table entries (16MB). */
     for ( i = 0; i < 8; ++i )
@@ -687,15 +616,6 @@ static bool __init 
efi_arch_use_config_file(EFI_SYSTEM_TABLE *SystemTable)
 
 static void __init efi_arch_flush_dcache_area(const void *vaddr, UINTN size) { 
}
 
-void EFIAPI efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable);
-
-void EFIAPI __init noreturn
-efi_mb_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
-{
-    __set_bit(EFI_MB_LOADER, &efi_flags);
-    efi_start(ImageHandle, SystemTable);
-}
-
 void __init efi_multiboot2(EFI_HANDLE ImageHandle,
                            EFI_SYSTEM_TABLE *SystemTable,
                            const multiboot2_tag_module_t *dom0_kernel)
diff --git a/xen/arch/x86/efi/mkreloc.c b/xen/arch/x86/efi/mkreloc.c
deleted file mode 100644
index 1aca796..0000000
--- a/xen/arch/x86/efi/mkreloc.c
+++ /dev/null
@@ -1,384 +0,0 @@
-#include <fcntl.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <unistd.h>
-
-struct mz_hdr {
-    uint16_t signature;
-#define MZ_SIGNATURE 0x5a4d
-    uint16_t last_page_size;
-    uint16_t page_count;
-    uint16_t relocation_count;
-    uint16_t header_paras;
-    uint16_t min_paras;
-    uint16_t max_paras;
-    uint16_t entry_ss;
-    uint16_t entry_sp;
-    uint16_t checksum;
-    uint16_t entry_ip;
-    uint16_t entry_cs;
-    uint16_t relocations;
-    uint16_t overlay;
-    uint8_t reserved[32];
-    uint32_t extended_header_base;
-};
-
-struct pe_hdr {
-    uint32_t signature;
-#define PE_SIGNATURE 0x00004550
-    uint16_t cpu;
-    uint16_t section_count;
-    int32_t timestamp;
-    uint32_t symbols_file_offset;
-    uint32_t symbol_count;
-    uint16_t opt_hdr_size;
-    uint16_t flags;
-    struct {
-        uint16_t magic;
-#define PE_MAGIC_EXE32     0x010b
-#define PE_MAGIC_EXE32PLUS 0x020b
-        uint8_t linker_major, linker_minor;
-        uint32_t code_size, data_size, bss_size;
-        uint32_t entry_rva, code_rva, data_rva;
-    } opt_hdr;
-};
-
-#define PE_PAGE_SIZE 0x1000
-
-#define PE_BASE_RELOC_ABS      0
-#define PE_BASE_RELOC_HIGHLOW  3
-#define PE_BASE_RELOC_DIR64   10
-
-struct coff_section {
-    char name[8];
-    uint32_t size;
-    uint32_t rva;
-    uint32_t file_size;
-    uint32_t file_offset;
-    uint32_t relocation_file_offset;
-    uint32_t line_number_file_offset;
-    uint16_t relocation_count;
-    uint16_t line_number_count;
-    uint32_t flags;
-#define COFF_SECTION_BSS         0x00000080U
-#define COFF_SECTION_DISCARDABLE 0x02000000U
-#define COFF_SECTION_WRITEABLE   0x80000000U
-};
-
-static void usage(const char *cmd, int rc)
-{
-    fprintf(rc ? stderr : stdout,
-            "Usage: %s <image1> <image2>\n",
-            cmd);
-    exit(rc);
-}
-
-static unsigned int load(const char *name, int *handle,
-                         struct coff_section **sections,
-                         uint_fast64_t *image_base,
-                         uint32_t *image_size,
-                         unsigned int *width)
-{
-    int in = open(name, O_RDONLY);
-    struct mz_hdr mz_hdr;
-    struct pe_hdr pe_hdr;
-    uint32_t base;
-
-    if ( in < 0 ||
-         read(in, &mz_hdr, sizeof(mz_hdr)) != sizeof(mz_hdr) )
-    {
-        perror(name);
-        exit(2);
-    }
-    if ( mz_hdr.signature != MZ_SIGNATURE ||
-         mz_hdr.relocations < sizeof(mz_hdr) ||
-         !mz_hdr.extended_header_base )
-    {
-        fprintf(stderr, "%s: Wrong DOS file format\n", name);
-        exit(2);
-    }
-
-    if ( lseek(in, mz_hdr.extended_header_base, SEEK_SET) < 0 ||
-         read(in, &pe_hdr, sizeof(pe_hdr)) != sizeof(pe_hdr) ||
-         read(in, &base, sizeof(base)) != sizeof(base) ||
-         /*
-          * Luckily the image size field lives at the
-          * same offset for both formats.
-          */
-         lseek(in, 24, SEEK_CUR) < 0 ||
-         read(in, image_size, sizeof(*image_size)) != sizeof(*image_size) )
-    {
-        perror(name);
-        exit(3);
-    }
-    switch ( (pe_hdr.signature == PE_SIGNATURE &&
-              pe_hdr.opt_hdr_size > sizeof(pe_hdr.opt_hdr)) *
-             pe_hdr.opt_hdr.magic )
-    {
-    case PE_MAGIC_EXE32:
-        *width = 32;
-        *image_base = base;
-        break;
-    case PE_MAGIC_EXE32PLUS:
-        *width = 64;
-        *image_base = ((uint64_t)base << 32) | pe_hdr.opt_hdr.data_rva;
-        break;
-    default:
-        fprintf(stderr, "%s: Wrong PE file format\n", name);
-        exit(3);
-    }
-
-    *sections = malloc(pe_hdr.section_count * sizeof(**sections));
-    if ( !*sections )
-    {
-        perror(NULL);
-        exit(4);
-    }
-    if ( lseek(in,
-               mz_hdr.extended_header_base + offsetof(struct pe_hdr, opt_hdr) +
-                  pe_hdr.opt_hdr_size,
-               SEEK_SET) < 0 ||
-         read(in, *sections, pe_hdr.section_count * sizeof(**sections)) !=
-             pe_hdr.section_count * sizeof(**sections) )
-    {
-        perror(name);
-        exit(4);
-    }
-
-    *handle = in;
-
-    return pe_hdr.section_count;
-}
-
-static long page_size;
-
-static const void *map_section(const struct coff_section *sec, int in,
-                               const char *name)
-{
-    const char *ptr;
-    unsigned long offs;
-
-    if ( !page_size )
-        page_size = sysconf(_SC_PAGESIZE);
-    offs = sec->file_offset & (page_size - 1);
-
-    ptr = mmap(0, offs + sec->file_size, PROT_READ, MAP_PRIVATE, in,
-               sec->file_offset - offs);
-    if ( ptr == MAP_FAILED )
-    {
-        perror(name);
-        exit(6);
-    }
-
-    return ptr + offs;
-}
-
-static void unmap_section(const void *ptr, const struct coff_section *sec)
-{
-    unsigned long offs = sec->file_offset & (page_size - 1);
-
-    munmap((char *)ptr - offs, offs + sec->file_size);
-}
-
-static void diff_sections(const unsigned char *ptr1, const unsigned char *ptr2,
-                          const struct coff_section *sec,
-                          int_fast64_t diff, unsigned int width,
-                          uint_fast64_t base, uint_fast64_t end)
-{
-    static uint_fast32_t cur_rva, reloc_size;
-    unsigned int disp = 0;
-    uint_fast32_t i;
-
-    if ( !sec )
-    {
-        reloc_size += reloc_size & 2;
-        if ( reloc_size )
-            printf("\t.balign 4\n"
-                   "\t.equ rva_%08" PRIxFAST32 "_relocs, %#08" PRIxFAST32 "\n",
-                   cur_rva, reloc_size);
-        return;
-    }
-
-    while ( !(diff & (((int_fast64_t)1 << ((disp + 1) * CHAR_BIT)) - 1)) )
-        ++disp;
-
-    for ( i = 0; i < sec->file_size; ++i )
-    {
-        uint_fast32_t rva;
-        union {
-            uint32_t u32;
-            uint64_t u64;
-        } val1, val2;
-        int_fast64_t delta;
-        unsigned int reloc = (width == 4 ? PE_BASE_RELOC_HIGHLOW :
-                                           PE_BASE_RELOC_DIR64);
-
-        if ( ptr1[i] == ptr2[i] )
-            continue;
-
-        if ( i < disp || i + width - disp > sec->file_size )
-        {
-            fprintf(stderr,
-                    "Bogus difference at %.8s:%08" PRIxFAST32 "\n",
-                    sec->name, i);
-            exit(3);
-        }
-
-        memcpy(&val1, ptr1 + i - disp, width);
-        memcpy(&val2, ptr2 + i - disp, width);
-        delta = width == 4 ? val2.u32 - val1.u32 : val2.u64 - val1.u64;
-        if ( delta != diff )
-        {
-            fprintf(stderr,
-                    "Difference at %.8s:%08" PRIxFAST32 " is %#" PRIxFAST64
-                    " (expected %#" PRIxFAST64 ")\n",
-                    sec->name, i, delta, diff);
-            continue;
-        }
-        if ( width == 8 && (val1.u64 < base || val1.u64 > end) )
-            reloc = PE_BASE_RELOC_HIGHLOW;
-
-        rva = (sec->rva + i - disp) & ~(PE_PAGE_SIZE - 1);
-        if ( rva > cur_rva )
-        {
-            reloc_size += reloc_size & 2;
-            if ( reloc_size )
-                printf("\t.equ rva_%08" PRIxFAST32 "_relocs,"
-                             " %#08" PRIxFAST32 "\n",
-                       cur_rva, reloc_size);
-            printf("\t.balign 4\n"
-                   "\t.long %#08" PRIxFAST32 ","
-                          " rva_%08" PRIxFAST32 "_relocs\n",
-                   rva, rva);
-            cur_rva = rva;
-            reloc_size = 8;
-        }
-        else if ( rva != cur_rva )
-        {
-            fprintf(stderr,
-                    "Cannot handle decreasing RVA (at %.8s:%08" PRIxFAST32 
")\n",
-                    sec->name, i);
-            exit(3);
-        }
-
-        if ( !(sec->flags & COFF_SECTION_WRITEABLE) )
-            fprintf(stderr,
-                    "Warning: relocation to r/o section %.8s:%08" PRIxFAST32 
"\n",
-                    sec->name, i);
-
-        printf("\t.word (%u << 12) | 0x%03" PRIxFAST32 "\n",
-               reloc, sec->rva + i - disp - rva);
-        reloc_size += 2;
-        i += width - disp - 1;
-    }
-}
-
-int main(int argc, char *argv[])
-{
-    int in1, in2;
-    unsigned int i, nsec, width1, width2;
-    uint_fast64_t base1, base2;
-    uint32_t size1, size2;
-    struct coff_section *sec1, *sec2;
-
-    if ( argc == 1 ||
-         !strcmp(argv[1], "-?") ||
-         !strcmp(argv[1], "-h") ||
-         !strcmp(argv[1], "--help") )
-        usage(*argv, argc == 1);
-
-    if ( argc != 3 )
-        usage(*argv, 1);
-
-    nsec = load(argv[1], &in1, &sec1, &base1, &size1, &width1);
-    if ( nsec != load(argv[2], &in2, &sec2, &base2, &size2, &width2) )
-    {
-        fputs("Mismatched section counts\n", stderr);
-        return 5;
-    }
-    if ( width1 != width2 )
-    {
-        fputs("Mismatched image types\n", stderr);
-        return 5;
-    }
-    width1 >>= 3;
-    if ( base1 == base2 )
-    {
-        fputs("Images must have different base addresses\n", stderr);
-        return 5;
-    }
-    if ( size1 != size2 )
-    {
-        fputs("Images must have identical sizes\n", stderr);
-        return 5;
-    }
-
-    puts("\t.section .reloc, \"a\", @progbits\n"
-         "\t.balign 4\n"
-         "\t.globl __base_relocs_start, __base_relocs_end\n"
-         "__base_relocs_start:");
-
-    for ( i = 0; i < nsec; ++i )
-    {
-        const void *ptr1, *ptr2;
-
-        if ( memcmp(sec1[i].name, sec2[i].name, sizeof(sec1[i].name)) ||
-             sec1[i].rva != sec2[i].rva ||
-             sec1[i].size != sec2[i].size ||
-             sec1[i].file_size != sec2[i].file_size ||
-             sec1[i].flags != sec2[i].flags )
-        {
-            fprintf(stderr, "Mismatched section %u parameters\n", i);
-            return 5;
-        }
-
-        if ( !sec1[i].size ||
-             (sec1[i].flags & (COFF_SECTION_DISCARDABLE|COFF_SECTION_BSS)) )
-            continue;
-
-        /*
-         * Don't generate relocations for sections that definitely
-         * aren't used by the boot loader code.
-         */
-        if ( memcmp(sec1[i].name, ".initcal", sizeof(sec1[i].name)) == 0 ||
-             memcmp(sec1[i].name, ".init.se", sizeof(sec1[i].name)) == 0 ||
-             memcmp(sec1[i].name, ".buildid", sizeof(sec1[i].name)) == 0 ||
-             memcmp(sec1[i].name, ".lockpro", sizeof(sec1[i].name)) == 0 )
-            continue;
-
-        if ( !sec1[i].rva )
-        {
-            fprintf(stderr, "Can't handle section %u with zero RVA\n", i);
-            return 3;
-        }
-
-        if ( sec1[i].file_size > sec1[i].size )
-        {
-            sec1[i].file_size = sec1[i].size;
-            sec2[i].file_size = sec2[i].size;
-        }
-        ptr1 = map_section(sec1 + i, in1, argv[1]);
-        ptr2 = map_section(sec2 + i, in2, argv[2]);
-
-        diff_sections(ptr1, ptr2, sec1 + i, base2 - base1, width1,
-                      base1, base1 + size1);
-
-        unmap_section(ptr1, sec1 + i);
-        unmap_section(ptr2, sec2 + i);
-    }
-
-    diff_sections(NULL, NULL, NULL, 0, 0, 0, 0);
-
-    puts("__base_relocs_end:");
-
-    close(in1);
-    close(in2);
-
-    return 0;
-}
diff --git a/xen/arch/x86/efi/relocs-dummy.S b/xen/arch/x86/efi/relocs-dummy.S
deleted file mode 100644
index d928a82..0000000
--- a/xen/arch/x86/efi/relocs-dummy.S
+++ /dev/null
@@ -1,11 +0,0 @@
-
-       .section .reloc, "a", @progbits
-       .balign 4
-GLOBAL(__base_relocs_start)
-       .long 0
-       .long 8
-GLOBAL(__base_relocs_end)
-
-       .globl VIRT_START, ALT_START
-       .equ VIRT_START, XEN_VIRT_START
-       .equ ALT_START, XEN_VIRT_END
diff --git a/xen/arch/x86/efi/stub.c b/xen/arch/x86/efi/stub.c
deleted file mode 100644
index 5918536..0000000
--- a/xen/arch/x86/efi/stub.c
+++ /dev/null
@@ -1,97 +0,0 @@
-#include <xen/types.h>
-#include <xen/efi.h>
-#include <xen/errno.h>
-#include <xen/init.h>
-#include <xen/lib.h>
-#include <xen/multiboot2.h>
-#include <asm/page.h>
-#include <asm/efibind.h>
-#include <efi/efidef.h>
-#include <efi/eficapsule.h>
-#include <efi/eficon.h>
-#include <efi/efidevp.h>
-#include <efi/efiapi.h>
-
-/*
- * Here we are in EFI stub. EFI calls are not supported due to lack
- * of relevant functionality in compiler and/or linker.
- *
- * efi_mb_start() and efi_multiboot2() are the exceptions.
- * Please look below for more details.
- */
-
-asm (
-    "    .text                         \n"
-    "    .globl efi_mb_start           \n"
-    "efi_mb_start:                     \n"
-    "    mov    %rcx,%rdi              \n"
-    "    mov    %rdx,%rsi              \n"
-    "    xor    %rdx,%rdx              \n"
-    "    call   efi_multiboot2         \n"
-    );
-
-void __init noreturn efi_multiboot2(EFI_HANDLE ImageHandle,
-                                    EFI_SYSTEM_TABLE *SystemTable,
-                                    const multiboot2_tag_module_t *dom0_kernel)
-{
-    static const CHAR16 __initconst err[] =
-        L"Xen does not have EFI code build in!\r\nSystem halted!\r\n";
-    SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr;
-
-    StdErr = SystemTable->StdErr ? SystemTable->StdErr : SystemTable->ConOut;
-
-    /*
-     * Print error message and halt the system.
-     *
-     * We have to open code MS x64 calling convention
-     * in assembly because here this convention may
-     * not be directly supported by C compiler.
-     */
-    asm volatile(
-    "    call *%3                     \n"
-    "0:  hlt                          \n"
-    "    jmp  0b                      \n"
-       : "+c" (StdErr), "=d" (StdErr) : "1" (err), "rm" (StdErr->OutputString)
-       : "rax", "r8", "r9", "r10", "r11", "memory");
-
-    unreachable();
-}
-
-bool efi_enabled(unsigned int feature)
-{
-    return false;
-}
-
-void __init efi_init_memory(void) { }
-
-void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t l4e) { }
-
-bool efi_rs_using_pgtables(void)
-{
-    return false;
-}
-
-unsigned long efi_get_time(void)
-{
-    BUG();
-    return 0;
-}
-
-void efi_halt_system(void) { }
-void efi_reset_system(bool warm) { }
-
-int efi_get_info(uint32_t idx, union xenpf_efi_info *info)
-{
-    return -ENOSYS;
-}
-
-int efi_compat_get_info(uint32_t idx, union compat_pf_efi_info *)
-    __attribute__((__alias__("efi_get_info")));
-
-int efi_runtime_call(struct xenpf_efi_runtime_call *op)
-{
-    return -ENOSYS;
-}
-
-int efi_compat_runtime_call(struct compat_pf_efi_runtime_call *)
-    __attribute__((__alias__("efi_runtime_call")));
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 1e5233a..43e0799 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -7,26 +7,12 @@
 #undef ENTRY
 #undef ALIGN
 
-#ifdef EFI
-
-#define FORMAT "pei-x86-64"
-#undef __XEN_VIRT_START
-#define __XEN_VIRT_START __image_base__
-#define SECTION_ALIGN MB(2)
-#define DECL_SECTION(x) x :
-
-ENTRY(efi_start)
-
-#else /* !EFI */
-
 #define FORMAT "elf64-x86-64"
 #define SECTION_ALIGN PAGE_SIZE
 #define DECL_SECTION(x) x : AT(ADDR(x) - __XEN_VIRT_START)
 
 ENTRY(start_pa)
 
-#endif /* EFI */
-
 OUTPUT_FORMAT(FORMAT, FORMAT, FORMAT)
 
 OUTPUT_ARCH(i386:x86-64)
@@ -34,18 +20,14 @@ OUTPUT_ARCH(i386:x86-64)
 PHDRS
 {
   text PT_LOAD ;
-#if (defined(BUILD_ID) || defined (CONFIG_PVH_GUEST)) && !defined(EFI)
+#if defined(BUILD_ID) || defined (CONFIG_PVH_GUEST)
   note PT_NOTE ;
 #endif
 }
 SECTIONS
 {
-#if !defined(EFI)
   . = __XEN_VIRT_START;
   __image_base__ = .;
-#else
-  . = __image_base__;
-#endif
 
 #if 0
 /*
@@ -60,9 +42,6 @@ SECTIONS
 
   start_pa = ABSOLUTE(start - __XEN_VIRT_START);
 
-#ifdef EFI
-  . = __XEN_VIRT_START + XEN_IMG_OFFSET;
-#else
   /*
    * The PE header must be followed by .text section which
    * starts at __XEN_VIRT_START + XEN_IMG_OFFSET address.
@@ -72,7 +51,6 @@ SECTIONS
   DECL_SECTION(.efi.pe.header) {
        *(.efi.pe.header)
   } :NONE
-#endif
 
   _start = .;
   DECL_SECTION(.text) {
@@ -117,16 +95,6 @@ SECTIONS
        *(.data.rel.ro)
        *(.data.rel.ro.*)
 
-#if defined(BUILD_ID) && defined(EFI) && !defined(BUILD_ID_EFI)
-/*
- * No mechanism to put an PT_NOTE in the EFI file - so put
- * it in .rodata section. (notes.o supplies us with .note.gnu.build-id).
- */
-       . = ALIGN(4);
-       __note_gnu_build_id_start = .;
-       *(.note.gnu.build-id)
-       __note_gnu_build_id_end = .;
-#endif
        . = ALIGN(8);
        /* Exception table */
        __start___ex_table = .;
@@ -157,32 +125,23 @@ SECTIONS
 #endif
   } :text
 
-#if defined(CONFIG_PVH_GUEST) && !defined(EFI)
+#if defined(CONFIG_PVH_GUEST)
   DECL_SECTION(.note.Xen) {
       *(.note.Xen)
   } :note :text
 #endif
 
 #if defined(BUILD_ID)
-#if !defined(EFI)
 /*
- * What a strange section name. The reason is that on ELF builds this section
- * is extracted to notes.o (which then is ingested in the EFI file). But the
- * compiler may want to inject other things in the .note which we don't care
- * about - hence this unique name.
+ * What a strange section name. The reason is that the compiler may want to
+ * inject other things in the .note which we don't care about - hence this
+ * unique name.
  */
   DECL_SECTION(.note.gnu.build-id) {
        __note_gnu_build_id_start = .;
        *(.note.gnu.build-id)
        __note_gnu_build_id_end = .;
   } :note :text
-#elif defined(BUILD_ID_EFI)
-  DECL_SECTION(.buildid) {
-       __note_gnu_build_id_start = .;
-       *(.buildid)
-       __note_gnu_build_id_end = .;
-  } :text
-#endif
 #endif
   _erodata = .;
 
@@ -192,11 +151,7 @@ SECTIONS
   __2M_init_start = .;         /* Start of 2M superpages, mapped RWX (boot 
only). */
   . = ALIGN(PAGE_SIZE);             /* Init code and data */
   __init_begin = .;
-#ifdef EFI /* EFI wants to merge all of .init.*  ELF doesn't. */
-  DECL_SECTION(.init) {
-#else
   DECL_SECTION(.init.text) {
-#endif
        _sinittext = .;
        *(.init.text)
        /*
@@ -207,12 +162,8 @@ SECTIONS
        *(.altinstr_replacement)
        _einittext = .;
 
-#ifdef EFI /* EFI wants to merge all of .init.*  ELF doesn't. */
-       . = ALIGN(SMP_CACHE_BYTES);
-#else
   } :text
   DECL_SECTION(.init.data) {
-#endif
 
        *(.init.rodata)
        *(.init.rodata.rel)
@@ -310,20 +261,6 @@ SECTIONS
 
   __pe_SizeOfImage = ALIGN(. - __image_base__, MB(16));
 
-#ifdef EFI
-  . = ALIGN(4);
-  .reloc : {
-    *(.reloc)
-  } :text
-  /* Trick the linker into setting the image size to exactly 16Mb. */
-  . = ALIGN(__section_alignment__);
-  .pad : {
-    . = ALIGN(MB(16));
-  } :text
-#endif
-
-  efi = DEFINED(efi) ? efi : .;
-
   /* Sections to be discarded */
   /DISCARD/ : {
        *(.exit.text)
@@ -332,12 +269,6 @@ SECTIONS
        *(.discard)
        *(.discard.*)
        *(.eh_frame)
-#ifdef EFI
-       *(.efi.pe.header)
-       *(.comment)
-       *(.comment.*)
-       *(.note.Xen)
-#endif
   }
 
   /* Stabs debugging sections.  */
@@ -381,11 +312,9 @@ ASSERT((trampoline_end - trampoline_start) < 
TRAMPOLINE_SPACE - MBI_SPACE_MIN,
 ASSERT((wakeup_stack - wakeup_stack_start) >= WAKEUP_STACK_MIN,
     "wakeup stack too small")
 
-#ifndef EFI
 ASSERT(efi_pe_head_end == _start, "PE header does not end at the beginning of 
.text section")
 ASSERT(_start == __XEN_VIRT_START + XEN_IMG_OFFSET, ".text section begins at 
wrong address")
 ASSERT(IS_ALIGNED(_start,      XEN_FILE_ALIGN), "_start misaligned")
 ASSERT(IS_ALIGNED(__bss_start, XEN_FILE_ALIGN), "__bss_start misaligned")
 ASSERT(IS_ALIGNED(__pe_SizeOfImage, XEN_LOAD_ALIGN), "__pe_SizeOfImage is not 
multiple of XEN_LOAD_ALIGN")
 ASSERT(XEN_LOAD_ALIGN >= XEN_FILE_ALIGN, "XEN_LOAD_ALIGN < XEN_FILE_ALIGN")
-#endif
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 06bfadc..a11f97b 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -1160,8 +1160,6 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE 
*SystemTable)
     PrintStr(L"Xen " __stringify(XEN_VERSION) "." __stringify(XEN_SUBVERSION)
              XEN_EXTRAVERSION " (c/s " XEN_CHANGESET ") EFI loader\r\n");
 
-    efi_arch_relocate_image(0);
-
     if ( use_cfg_file )
     {
         EFI_FILE_HANDLE dir_handle;
diff --git a/xen/common/version.c b/xen/common/version.c
index 223cb52..3b4ff9a 100644
--- a/xen/common/version.c
+++ b/xen/common/version.c
@@ -4,7 +4,6 @@
 #include <xen/lib.h>
 #include <xen/string.h>
 #include <xen/types.h>
-#include <xen/efi.h>
 #include <xen/elf.h>
 #include <xen/version.h>
 
@@ -118,28 +117,6 @@ int xen_build_id_check(const Elf_Note *n, unsigned int 
n_sz,
     return 0;
 }
 
-struct pe_external_debug_directory
-{
-    uint32_t characteristics;
-    uint32_t time_stamp;
-    uint16_t major_version;
-    uint16_t minor_version;
-#define PE_IMAGE_DEBUG_TYPE_CODEVIEW 2
-    uint32_t type;
-    uint32_t size;
-    uint32_t rva_of_data;
-    uint32_t filepos_of_data;
-};
-
-struct cv_info_pdb70
-{
-#define CVINFO_PDB70_CVSIGNATURE 0x53445352 /* "RSDS" */
-    uint32_t cv_signature;
-    unsigned char signature[16];
-    uint32_t age;
-    char pdb_filename[];
-};
-
 static int __init xen_build_init(void)
 {
     const Elf_Note *n = __note_gnu_build_id_start;
@@ -158,34 +135,6 @@ static int __init xen_build_init(void)
 
     rc = xen_build_id_check(n, sz, &build_id_p, &build_id_len);
 
-#ifdef CONFIG_X86
-    /* Alternatively we may have a CodeView record from an EFI build. */
-    if ( rc && efi_enabled(EFI_LOADER) )
-    {
-        const struct pe_external_debug_directory *dir = (const void *)n;
-
-        /*
-         * Validate that the full-note-header check above won't prevent
-         * fall-through to the CodeView case here.
-         */
-        BUILD_BUG_ON(sizeof(*n) > sizeof(*dir));
-
-        if ( sz > sizeof(*dir) + sizeof(struct cv_info_pdb70) &&
-             dir->type == PE_IMAGE_DEBUG_TYPE_CODEVIEW &&
-             dir->size > sizeof(struct cv_info_pdb70) &&
-             XEN_VIRT_START + dir->rva_of_data == (unsigned long)(dir + 1) )
-        {
-            const struct cv_info_pdb70 *info = (const void *)(dir + 1);
-
-            if ( info->cv_signature == CVINFO_PDB70_CVSIGNATURE )
-            {
-                build_id_p = info->signature;
-                build_id_len = sizeof(info->signature);
-                rc = 0;
-            }
-        }
-    }
-#endif
     if ( !rc )
         printk(XENLOG_INFO "build-id: %*phN\n", build_id_len, build_id_p);
 
diff --git a/xen/include/xen/efi.h b/xen/include/xen/efi.h
index 73f83c1..44b7d3e 100644
--- a/xen/include/xen/efi.h
+++ b/xen/include/xen/efi.h
@@ -11,7 +11,6 @@ extern unsigned int efi_flags;
 #define EFI_BOOT       0       /* Were we booted from EFI? */
 #define EFI_LOADER     1       /* Were we booted directly from EFI loader? */
 #define EFI_RS         2       /* Can we use runtime services? */
-#define EFI_MB_LOADER  4       /* xen.mb.efi booted directly from EFI loader? 
*/
 
 /* Add fields here only if they need to be referenced from non-EFI code. */
 struct efi {
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.