Index: stable/11/stand/efi/boot1/Makefile =================================================================== --- stable/11/stand/efi/boot1/Makefile (revision 344408) +++ stable/11/stand/efi/boot1/Makefile (revision 344409) @@ -1,108 +1,109 @@ # $FreeBSD$ .include PROG= boot1.sym INTERNALPROG= WARNS?= 6 +CFLAGS+= -DEFI_BOOT1 # We implement a slightly non-standard %S in that it always takes a # CHAR16 that's common in UEFI-land instead of a wchar_t. This only # seems to matter on arm64 where wchar_t defaults to an int instead # of a short. There's no good cast to use here so just ignore the # warnings for now. CWARNFLAGS.boot1.c+= -Wno-format # Disable warnings that are currently incompatible with the zfs boot code CWARNFLAGS.zfs_module.c += -Wno-array-bounds CWARNFLAGS.zfs_module.c += -Wno-cast-align CWARNFLAGS.zfs_module.c += -Wno-cast-qual CWARNFLAGS.zfs_module.c += -Wno-missing-prototypes CWARNFLAGS.zfs_module.c += -Wno-sign-compare CWARNFLAGS.zfs_module.c += -Wno-unused-parameter CWARNFLAGS.zfs_module.c += -Wno-unused-function # architecture-specific loader code SRCS= boot1.c self_reloc.c start.S ufs_module.c .if ${MK_LOADER_ZFS} != "no" SRCS+= zfs_module.c CFLAGS.zfs_module.c+= -I${ZFSSRC} CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/boot/zfs CFLAGS.zfs_module.c+= -I${SYSDIR}/crypto/skein CFLAGS+= -DEFI_ZFS_BOOT .endif .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201 CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized .endif CFLAGS+= -I${EFIINC} CFLAGS+= -I${EFIINCMD} CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include CFLAGS+= -DEFI_UFS_BOOT .ifdef(EFI_DEBUG) CFLAGS+= -DEFI_DEBUG .endif # Always add MI sources and REGULAR efi loader bits .PATH: ${EFISRC}/loader/arch/${MACHINE} .PATH: ${EFISRC}/loader .PATH: ${LDRSRC} CFLAGS+= -I${LDRSRC} FILES= boot1.efi boot1.efifat FILESMODE_boot1.efi= ${BINMODE} LDSCRIPT= ${EFISRC}/loader/arch/${MACHINE}/ldscript.${MACHINE} LDFLAGS+= -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared .if ${MACHINE_CPUARCH} == "aarch64" CFLAGS+= -mgeneral-regs-only .endif .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" CFLAGS+= -fPIC LDFLAGS+= -Wl,-znocombreloc .endif LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a # # Add libstand for the runtime functions used by the compiler - for example # __aeabi_* (arm) or __divdi3 (i386). # as well as required string and memory functions for all platforms. # DPADD+= ${LIBEFI} ${LIBSA} LDADD+= ${LIBEFI} ${LIBSA} DPADD+= ${LDSCRIPT} boot1.efi: ${PROG} if ${NM} ${.ALLSRC} | grep ' U '; then \ echo "Undefined symbols in ${.ALLSRC}"; \ exit 1; \ fi SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \ -j .dynamic -j .dynsym -j .rel.dyn \ -j .rela.dyn -j .reloc -j .eh_frame \ --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET} # The following inserts our objects into a template FAT file system # created by generate-fat.sh .include "Makefile.fat" boot1.efifat: boot1.efi @set -- `ls -l ${.ALLSRC}`; \ x=$$(($$5-${BOOT1_MAXSIZE})); \ if [ $$x -ge 0 ]; then \ echo "boot1 $$x bytes too large; regenerate FAT templates?" >&2 ;\ exit 1; \ fi echo ${.OBJDIR} xz -d -c ${BOOTSRC}/efi/boot1/fat-${MACHINE}.tmpl.xz > ${.TARGET} ${DD} if=${.ALLSRC} of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc CLEANFILES+= boot1.efi boot1.efifat .include Index: stable/11/stand/efi/loader/arch/arm64/start.S =================================================================== --- stable/11/stand/efi/loader/arch/arm64/start.S (revision 344408) +++ stable/11/stand/efi/loader/arch/arm64/start.S (revision 344409) @@ -1,165 +1,182 @@ /*- * Copyright (c) 2014 Andrew Turner * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ /* * We need to be a PE32+ file for EFI. On some architectures we can use * objcopy to create the correct file, however on arm64 we need to do * it ourselves. */ #define IMAGE_FILE_MACHINE_ARM64 0xaa64 #define IMAGE_SCN_CNT_CODE 0x00000020 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 #define IMAGE_SCN_MEM_EXECUTE 0x20000000 #define IMAGE_SCN_MEM_READ 0x40000000 .section .peheader,"a" efi_start: /* The MS-DOS Stub, only used to get the offset of the COFF header */ .ascii "MZ" .short 0 .space 0x38 .long pe_sig - efi_start /* The PE32 Signature. Needs to be 8-byte aligned */ .align 3 pe_sig: .ascii "PE" .short 0 coff_head: .short IMAGE_FILE_MACHINE_ARM64 /* AArch64 file */ .short 2 /* 2 Sections */ .long 0 /* Timestamp */ .long 0 /* No symbol table */ .long 0 /* No symbols */ .short section_table - optional_header /* Optional header size */ .short 0 /* Characteristics TODO: Fill in */ optional_header: .short 0x020b /* PE32+ (64-bit addressing) */ .byte 0 /* Major linker version */ .byte 0 /* Minor linker version */ .long _edata - _end_header /* Code size */ .long 0 /* No initialized data */ .long 0 /* No uninitialized data */ .long _start - efi_start /* Entry point */ .long _end_header - efi_start /* Start of code */ optional_windows_header: .quad 0 /* Image base */ .long 32 /* Section Alignment */ .long 8 /* File alignment */ .short 0 /* Major OS version */ .short 0 /* Minor OS version */ .short 0 /* Major image version */ .short 0 /* Minor image version */ .short 0 /* Major subsystem version */ .short 0 /* Minor subsystem version */ .long 0 /* Win32 version */ .long _edata - efi_start /* Image size */ .long _end_header - efi_start /* Header size */ .long 0 /* Checksum */ .short 0xa /* Subsystem (EFI app) */ .short 0 /* DLL Characteristics */ .quad 0 /* Stack reserve */ .quad 0 /* Stack commit */ .quad 0 /* Heap reserve */ .quad 0 /* Heap commit */ .long 0 /* Loader flags */ .long 6 /* Number of RVAs */ /* RVAs: */ .quad 0 .quad 0 .quad 0 .quad 0 .quad 0 .quad 0 section_table: /* We need a .reloc section for EFI */ .ascii ".reloc" .byte 0 .byte 0 /* Pad to 8 bytes */ .long 0 /* Virtual size */ .long 0 /* Virtual address */ .long 0 /* Size of raw data */ .long 0 /* Pointer to raw data */ .long 0 /* Pointer to relocations */ .long 0 /* Pointer to line numbers */ .short 0 /* Number of relocations */ .short 0 /* Number of line numbers */ .long (IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ | \ IMAGE_SCN_MEM_DISCARDABLE) /* Characteristics */ /* The contents of the loader */ .ascii ".text" .byte 0 .byte 0 .byte 0 /* Pad to 8 bytes */ .long _edata - _end_header /* Virtual size */ .long _end_header - efi_start /* Virtual address */ .long _edata - _end_header /* Size of raw data */ .long _end_header - efi_start /* Pointer to raw data */ .long 0 /* Pointer to relocations */ .long 0 /* Pointer to line numbers */ .short 0 /* Number of relocations */ .short 0 /* Number of line numbers */ .long (IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE | \ IMAGE_SCN_MEM_READ) /* Characteristics */ _end_header: .text .globl _start _start: /* Save the boot params to the stack */ stp x0, x1, [sp, #-16]! adr x0, __bss_start adr x1, __bss_end b 2f 1: stp xzr, xzr, [x0], #16 2: cmp x0, x1 b.lo 1b adr x0, ImageBase adr x1, _DYNAMIC bl self_reloc ldp x0, x1, [sp], #16 +#ifndef EFI_BOOT1 + /* + * Load the stack to use. The default stack may be too small for + * the lua loader. + */ + adr x2, initstack_end + mov sp, x2 +#endif + bl efi_main 1: b 1b + +#ifndef EFI_BOOT1 +.bss + .align 4 +initstack: + .space (64 * 1024) +initstack_end: +#endif Index: stable/11 =================================================================== --- stable/11 (revision 344408) +++ stable/11 (revision 344409) Property changes on: stable/11 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head:r338337