diff options
author | 2019-05-11 19:14:41 +0000 | |
---|---|---|
committer | 2019-05-11 19:14:41 +0000 | |
commit | 62c1be297ffa458d28834943e6915f090cd8c60e (patch) | |
tree | e068a9cf072227e8b5bc8563592ea35cf80dc266 | |
parent | Repair and improve v6 default route selection. (diff) | |
download | wireguard-openbsd-62c1be297ffa458d28834943e6915f090cd8c60e.tar.xz wireguard-openbsd-62c1be297ffa458d28834943e6915f090cd8c60e.zip |
Further cleanup of efi32/64.
Removes some code and files not needed by efi32 and efi64.
ok guenther
-rw-r--r-- | sys/arch/amd64/stand/efi32/Makefile | 4 | ||||
-rw-r--r-- | sys/arch/amd64/stand/efi32/efiboot.c | 20 | ||||
-rw-r--r-- | sys/arch/amd64/stand/efi32/eficall.h | 38 | ||||
-rw-r--r-- | sys/arch/amd64/stand/efi32/exec_i386.c | 16 | ||||
-rw-r--r-- | sys/arch/amd64/stand/efi32/ldscript.amd64 | 65 | ||||
-rw-r--r-- | sys/arch/amd64/stand/efi32/self_reloc.c | 23 | ||||
-rw-r--r-- | sys/arch/amd64/stand/efi32/start_amd64.S | 76 | ||||
-rw-r--r-- | sys/arch/amd64/stand/efi64/Makefile | 4 | ||||
-rw-r--r-- | sys/arch/amd64/stand/efi64/efiboot.c | 15 | ||||
-rw-r--r-- | sys/arch/amd64/stand/efi64/eficall.h | 9 | ||||
-rw-r--r-- | sys/arch/amd64/stand/efi64/exec_i386.c | 17 | ||||
-rw-r--r-- | sys/arch/amd64/stand/efi64/ldscript.i386 | 75 | ||||
-rw-r--r-- | sys/arch/amd64/stand/efi64/self_reloc.c | 22 | ||||
-rw-r--r-- | sys/arch/amd64/stand/efi64/start_i386.S | 68 |
14 files changed, 14 insertions, 438 deletions
diff --git a/sys/arch/amd64/stand/efi32/Makefile b/sys/arch/amd64/stand/efi32/Makefile index d1e9f399611..b0f146442fa 100644 --- a/sys/arch/amd64/stand/efi32/Makefile +++ b/sys/arch/amd64/stand/efi32/Makefile @@ -1,8 +1,8 @@ -# $OpenBSD: Makefile,v 1.1 2019/05/11 02:33:34 mlarkin Exp $ +# $OpenBSD: Makefile,v 1.2 2019/05/11 19:14:41 mlarkin Exp $ .if ${MACHINE} == "amd64" -SUBDIR= bootx64 bootia32 +SUBDIR= bootia32 .endif diff --git a/sys/arch/amd64/stand/efi32/efiboot.c b/sys/arch/amd64/stand/efi32/efiboot.c index 72b0e45ac20..abfb642a197 100644 --- a/sys/arch/amd64/stand/efi32/efiboot.c +++ b/sys/arch/amd64/stand/efi32/efiboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efiboot.c,v 1.1 2019/05/11 02:33:34 mlarkin Exp $ */ +/* $OpenBSD: efiboot.c,v 1.2 2019/05/11 19:14:41 mlarkin Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -115,38 +115,20 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) } } -#ifdef __amd64__ - /* allocate run_i386_start() on heap */ - if ((run_i386 = alloc(run_i386_size)) == NULL) - panic("alloc() failed"); - memcpy(run_i386, run_i386_start, run_i386_size); -#endif - /* can't use sa_cleanup since printf is used after sa_cleanup() */ /* sa_cleanup = efi_cleanup; */ -#ifdef __amd64__ - progname = "BOOTX64"; -#else progname = "BOOTIA32"; -#endif /* * Move the stack before calling boot(). UEFI on some machines * locate the stack on our kernel load address. */ stack = heap + heapsiz; -#if defined(__amd64__) - asm("movq %0, %%rsp;" - "mov %1, %%edi;" - "call boot;" - :: "r"(stack - 32), "r"(bios_bootdev)); -#else asm("movl %0, %%esp;" "movl %1, (%%esp);" "call boot;" :: "r"(stack - 32), "r"(bios_bootdev)); -#endif /* must not reach here */ return (EFI_SUCCESS); } diff --git a/sys/arch/amd64/stand/efi32/eficall.h b/sys/arch/amd64/stand/efi32/eficall.h index 2d8cf2923d2..fc15b0e606c 100644 --- a/sys/arch/amd64/stand/efi32/eficall.h +++ b/sys/arch/amd64/stand/efi32/eficall.h @@ -1,4 +1,4 @@ -/* $OpenBSD: eficall.h,v 1.1 2019/05/11 02:33:34 mlarkin Exp $ */ +/* $OpenBSD: eficall.h,v 1.2 2019/05/11 19:14:41 mlarkin Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -16,40 +16,4 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#if !defined(__amd64__) - #define EFI_CALL(_func_, ...) (_func_)(__VA_ARGS__) - -#else - -extern uint64_t efi_call(int, void *, ...); - -#define _call_0(_func) \ - efi_call(0, (_func)) -#define _call_1(_func, _1) \ - efi_call(1, (_func), (_1)) -#define _call_2(_func, _1, _2) \ - efi_call(2, (_func), (_1), (_2)) -#define _call_3(_func, _1, _2, _3) \ - efi_call(3, (_func), (_1), (_2), (_3)) -#define _call_4(_func, _1, _2, _3, _4) \ - efi_call(4, (_func), (_1), (_2), (_3), (_4)) -#define _call_5(_func, _1, _2, _3, _4, _5) \ - efi_call(5, (_func), (_1), (_2), (_3), (_4), (_5)) -#define _call_6(_func, _1, _2, _3, _4, _5, _6) \ - efi_call(6, (_func), (_1), (_2), (_3), (_4), (_5), (_6)) -#define _call_7(_func, _1, _2, _3, _4, _5, _6, _7) \ - efi_call(7, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7)) -#define _call_8(_func, _1, _2, _3, _4, _5, _6, _7, _8) \ - efi_call(8, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7), (_8)) -#define _call_9(_func, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ - efi_call(9, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7), (_8), (_9)) -#define _call_10(_func, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ - efi_call(10, (_func), (_1), (_2), (_3), (_4), (_5), (_6), (_7), (_8), (_9), (_10)) - -#define _efi_call_fn(_func, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _fn, ...) _fn - -#define EFI_CALL(...) \ - _efi_call_fn(__VA_ARGS__, _call_10, _call_9, _call_8, _call_7, _call_6, \ - _call_5, _call_4, _call_3, _call_2, _call_1, _call_0)(__VA_ARGS__) -#endif diff --git a/sys/arch/amd64/stand/efi32/exec_i386.c b/sys/arch/amd64/stand/efi32/exec_i386.c index 87c5c98b5e9..7e7aa4aee14 100644 --- a/sys/arch/amd64/stand/efi32/exec_i386.c +++ b/sys/arch/amd64/stand/efi32/exec_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_i386.c,v 1.1 2019/05/11 02:33:34 mlarkin Exp $ */ +/* $OpenBSD: exec_i386.c,v 1.2 2019/05/11 19:14:41 mlarkin Exp $ */ /* * Copyright (c) 1997-1998 Michael Shalayeff @@ -132,15 +132,7 @@ run_loadfile(uint64_t *marks, int howto) /* Pass memory map to the kernel */ mem_pass(); - /* - * This code may be used both for 64bit and 32bit. Make sure the - * bootarg is always 32bit, even on amd64. - */ -#ifdef __amd64__ - makebootargs32(av, &ac); -#else makebootargs(av, &ac); -#endif /* * Move the loaded kernel image to the usual place after calling @@ -151,14 +143,10 @@ run_loadfile(uint64_t *marks, int howto) for (i = 0; i < MARK_MAX; i++) marks[i] += delta; -#ifdef __amd64__ - (*run_i386)((u_long)run_i386, entry, howto, bootdev, BOOTARG_APIVER, - marks[MARK_END], extmem, cnvmem, ac, (intptr_t)av); -#else /* stack and the gung is ok at this point, so, no need for asm setup */ (*(startfuncp)entry)(howto, bootdev, BOOTARG_APIVER, marks[MARK_END], extmem, cnvmem, ac, (int)av); -#endif + /* not reached */ } diff --git a/sys/arch/amd64/stand/efi32/ldscript.amd64 b/sys/arch/amd64/stand/efi32/ldscript.amd64 deleted file mode 100644 index ab3ab48c3a9..00000000000 --- a/sys/arch/amd64/stand/efi32/ldscript.amd64 +++ /dev/null @@ -1,65 +0,0 @@ -/* Same as elf_x86_64_fbsd_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */ -OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") -OUTPUT_ARCH(i386:x86-64) -ENTRY(_start) -SECTIONS -{ - . = 0; - ImageBase = .; - .hash : { *(.hash) } /* this MUST come first! */ - . = ALIGN(4096); - .eh_frame : - { - *(.eh_frame) - } - . = ALIGN(4096); - .text : - { - *(.text) - *(.text.*) - *(.gnu.linkonce.t.*) - } - . = ALIGN(4096); - .reloc : - { - *(.reloc) - } - . = ALIGN(4096); - .data : - { - *(.rodata*) - *(.got.plt) - *(.got) - *(.data*) - *(.sdata) - /* the EFI loader doesn't seem to like a .bss section, so we stick - it all into .data: */ - *(.sbss) - *(.scommon) - *(.dynbss) - *(.bss) - *(COMMON) - *(.rel.local) - } - . = ALIGN(4096); - .dynamic : { *(.dynamic) } - . = ALIGN(4096); - .rela : - { - *(.rela.data*) - *(.rela.got) - *(.rela.stab) - } - . = ALIGN(4096); - .dynsym : { *(.dynsym) } - . = ALIGN(4096); - .dynstr : { *(.dynstr) } - . = ALIGN(4096); - .ignored.reloc : - { - *(.rela.reloc) - *(.eh_frame) - *(.note.GNU-stack) - } - .comment 0 : { *(.comment) } -} diff --git a/sys/arch/amd64/stand/efi32/self_reloc.c b/sys/arch/amd64/stand/efi32/self_reloc.c index 75ccf65bad6..c3997763dae 100644 --- a/sys/arch/amd64/stand/efi32/self_reloc.c +++ b/sys/arch/amd64/stand/efi32/self_reloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: self_reloc.c,v 1.1 2019/05/11 02:33:34 mlarkin Exp $ */ +/* $OpenBSD: self_reloc.c,v 1.2 2019/05/11 19:14:41 mlarkin Exp $ */ /*- * Copyright (c) 2008-2010 Rui Paulo <rpaulo@FreeBSD.org> * All rights reserved. @@ -28,36 +28,15 @@ #include <sys/param.h> #include <machine/reloc.h> -#if defined(__aarch64__) || defined(__amd64__) -#define ELFSIZE 64 -#define ElfW_Rel Elf64_Rela -#define ElfW_Dyn Elf64_Dyn -#define ELFW_R_TYPE ELF64_R_TYPE -#define ELF_RELA -#elif defined(__arm__) || defined(__i386__) #define ELFSIZE 32 #define ElfW_Rel Elf32_Rel #define ElfW_Dyn Elf32_Dyn #define ELFW_R_TYPE ELF32_R_TYPE -#else -#error architecture not supported -#endif #include <sys/exec_elf.h> -#if defined(__aarch64__) -#define RELOC_TYPE_NONE R_AARCH64_NONE -#define RELOC_TYPE_RELATIVE R_AARCH64_RELATIVE -#elif defined(__amd64__) -#define RELOC_TYPE_NONE R_X86_64_NONE -#define RELOC_TYPE_RELATIVE R_X86_64_RELATIVE -#elif defined(__arm__) -#define RELOC_TYPE_NONE R_ARM_NONE -#define RELOC_TYPE_RELATIVE R_ARM_RELATIVE -#elif defined(__i386__) #define RELOC_TYPE_NONE R_386_NONE #define RELOC_TYPE_RELATIVE R_386_RELATIVE -#endif /* * A simple elf relocator. diff --git a/sys/arch/amd64/stand/efi32/start_amd64.S b/sys/arch/amd64/stand/efi32/start_amd64.S deleted file mode 100644 index 171dbff3d0a..00000000000 --- a/sys/arch/amd64/stand/efi32/start_amd64.S +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * Copyright (C) 1999 Hewlett-Packard Co. - * Contributed by David Mosberger <davidm@hpl.hp.com>. - * Copyright (C) 2005 Intel Co. - * Contributed by Fenghua Yu <fenghua.yu@intel.com>. - * 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. - * 3. Neither the name of Hewlett-Packard Co. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT - * OWNER 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. - */ - -/* - * crt0-efi-x86_64.S - x86_64 EFI startup code. - * $FreeBSD: head/sys/boot/efi/loader/arch/amd64/start.S 282727 2015-05-10 13:24:26Z ian $ - */ - - .text - .align 4 - - .globl _start -_start: - subq $8, %rsp - pushq %rcx - pushq %rdx - -0: - lea ImageBase(%rip), %rdi - lea _DYNAMIC(%rip), %rsi - - popq %rcx - popq %rdx - pushq %rcx - pushq %rdx - call self_reloc - - popq %rdi - popq %rsi - - call efi_main - addq $8, %rsp - -.exit: - ret - - /* - * hand-craft a dummy .reloc section so EFI knows it's a relocatable - * executable: - */ - - .data - .section .reloc, "a" - .long 0 - .long 10 - .word 0 diff --git a/sys/arch/amd64/stand/efi64/Makefile b/sys/arch/amd64/stand/efi64/Makefile index 9b1d7b279c7..db770e703e5 100644 --- a/sys/arch/amd64/stand/efi64/Makefile +++ b/sys/arch/amd64/stand/efi64/Makefile @@ -1,8 +1,8 @@ -# $OpenBSD: Makefile,v 1.1 2019/05/11 02:36:10 mlarkin Exp $ +# $OpenBSD: Makefile,v 1.2 2019/05/11 19:14:41 mlarkin Exp $ .if ${MACHINE} == "amd64" -SUBDIR= bootx64 bootia32 +SUBDIR= bootx64 .endif diff --git a/sys/arch/amd64/stand/efi64/efiboot.c b/sys/arch/amd64/stand/efi64/efiboot.c index 32d4622e0a3..12b945c2095 100644 --- a/sys/arch/amd64/stand/efi64/efiboot.c +++ b/sys/arch/amd64/stand/efi64/efiboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efiboot.c,v 1.1 2019/05/11 02:36:10 mlarkin Exp $ */ +/* $OpenBSD: efiboot.c,v 1.2 2019/05/11 19:14:41 mlarkin Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -115,38 +115,25 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) } } -#ifdef __amd64__ /* allocate run_i386_start() on heap */ if ((run_i386 = alloc(run_i386_size)) == NULL) panic("alloc() failed"); memcpy(run_i386, run_i386_start, run_i386_size); -#endif /* can't use sa_cleanup since printf is used after sa_cleanup() */ /* sa_cleanup = efi_cleanup; */ -#ifdef __amd64__ progname = "BOOTX64"; -#else - progname = "BOOTIA32"; -#endif /* * Move the stack before calling boot(). UEFI on some machines * locate the stack on our kernel load address. */ stack = heap + heapsiz; -#if defined(__amd64__) asm("movq %0, %%rsp;" "mov %1, %%edi;" "call boot;" :: "r"(stack - 32), "r"(bios_bootdev)); -#else - asm("movl %0, %%esp;" - "movl %1, (%%esp);" - "call boot;" - :: "r"(stack - 32), "r"(bios_bootdev)); -#endif /* must not reach here */ return (EFI_SUCCESS); } diff --git a/sys/arch/amd64/stand/efi64/eficall.h b/sys/arch/amd64/stand/efi64/eficall.h index bfcce9f233d..4781622daf9 100644 --- a/sys/arch/amd64/stand/efi64/eficall.h +++ b/sys/arch/amd64/stand/efi64/eficall.h @@ -1,4 +1,4 @@ -/* $OpenBSD: eficall.h,v 1.1 2019/05/11 02:36:10 mlarkin Exp $ */ +/* $OpenBSD: eficall.h,v 1.2 2019/05/11 19:14:41 mlarkin Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -16,12 +16,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#if !defined(__amd64__) - -#define EFI_CALL(_func_, ...) (_func_)(__VA_ARGS__) - -#else - extern uint64_t efi_call(int, void *, ...); #define _call_0(_func) \ @@ -52,4 +46,3 @@ extern uint64_t efi_call(int, void *, ...); #define EFI_CALL(...) \ _efi_call_fn(__VA_ARGS__, _call_10, _call_9, _call_8, _call_7, _call_6, \ _call_5, _call_4, _call_3, _call_2, _call_1, _call_0)(__VA_ARGS__) -#endif diff --git a/sys/arch/amd64/stand/efi64/exec_i386.c b/sys/arch/amd64/stand/efi64/exec_i386.c index 4eabe3ef225..e8e1d60e6ad 100644 --- a/sys/arch/amd64/stand/efi64/exec_i386.c +++ b/sys/arch/amd64/stand/efi64/exec_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_i386.c,v 1.1 2019/05/11 02:36:10 mlarkin Exp $ */ +/* $OpenBSD: exec_i386.c,v 1.2 2019/05/11 19:14:41 mlarkin Exp $ */ /* * Copyright (c) 1997-1998 Michael Shalayeff @@ -132,15 +132,7 @@ run_loadfile(uint64_t *marks, int howto) /* Pass memory map to the kernel */ mem_pass(); - /* - * This code may be used both for 64bit and 32bit. Make sure the - * bootarg is always 32bit, even on amd64. - */ -#ifdef __amd64__ makebootargs32(av, &ac); -#else - makebootargs(av, &ac); -#endif /* * Move the loaded kernel image to the usual place after calling @@ -151,14 +143,9 @@ run_loadfile(uint64_t *marks, int howto) for (i = 0; i < MARK_MAX; i++) marks[i] += delta; -#ifdef __amd64__ (*run_i386)((u_long)run_i386, entry, howto, bootdev, BOOTARG_APIVER, marks[MARK_END], extmem, cnvmem, ac, (intptr_t)av); -#else - /* stack and the gung is ok at this point, so, no need for asm setup */ - (*(startfuncp)entry)(howto, bootdev, BOOTARG_APIVER, marks[MARK_END], - extmem, cnvmem, ac, (int)av); -#endif + /* not reached */ } diff --git a/sys/arch/amd64/stand/efi64/ldscript.i386 b/sys/arch/amd64/stand/efi64/ldscript.i386 deleted file mode 100644 index 975e36c14f5..00000000000 --- a/sys/arch/amd64/stand/efi64/ldscript.i386 +++ /dev/null @@ -1,75 +0,0 @@ -OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") -OUTPUT_ARCH(i386) -ENTRY(_start) -SECTIONS -{ - . = 0; - ImageBase = .; - .hash : { *(.hash) } /* this MUST come first! */ - . = ALIGN(4096); - .text : - { - *(.text) - *(.text.*) - *(.gnu.linkonce.t.*) - } - . = ALIGN(4096); - .sdata : - { - *(.got.plt) - *(.got) - *(.srodata) - *(.sdata) - *(.sbss) - *(.scommon) - } - . = ALIGN(4096); - .data : - { - *(.rodata*) - *(.data) - *(.data1) - *(.data.*) - *(.sdata) - *(.got.plt) - *(.got) - /* the EFI loader doesn't seem to like a .bss section, so we stick - it all into .data: */ - *(.sbss) - *(.scommon) - *(.dynbss) - *(.bss) - *(COMMON) - } - . = ALIGN(4096); - .dynamic : { *(.dynamic) } - . = ALIGN(4096); - .rel : - { - *(.rel.data) - *(.rel.data.*) - *(.rel.got) - *(.rel.stab) - *(.data.rel.ro.local) - *(.data.rel.local) - *(.data.rel.ro) - *(.data.rel*) - } - . = ALIGN(4096); - .reloc : /* This is the PECOFF .reloc section! */ - { - *(.reloc) - } - . = ALIGN(4096); - .dynsym : { *(.dynsym) } - . = ALIGN(4096); - .dynstr : { *(.dynstr) } - . = ALIGN(4096); - /DISCARD/ : - { - *(.rel.reloc) - *(.eh_frame) - *(.note.GNU-stack) - } - .comment 0 : { *(.comment) } -} diff --git a/sys/arch/amd64/stand/efi64/self_reloc.c b/sys/arch/amd64/stand/efi64/self_reloc.c index 14dca174e79..9e56103b332 100644 --- a/sys/arch/amd64/stand/efi64/self_reloc.c +++ b/sys/arch/amd64/stand/efi64/self_reloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: self_reloc.c,v 1.1 2019/05/11 02:36:10 mlarkin Exp $ */ +/* $OpenBSD: self_reloc.c,v 1.2 2019/05/11 19:14:41 mlarkin Exp $ */ /*- * Copyright (c) 2008-2010 Rui Paulo <rpaulo@FreeBSD.org> * All rights reserved. @@ -28,36 +28,16 @@ #include <sys/param.h> #include <machine/reloc.h> -#if defined(__aarch64__) || defined(__amd64__) #define ELFSIZE 64 #define ElfW_Rel Elf64_Rela #define ElfW_Dyn Elf64_Dyn #define ELFW_R_TYPE ELF64_R_TYPE #define ELF_RELA -#elif defined(__arm__) || defined(__i386__) -#define ELFSIZE 32 -#define ElfW_Rel Elf32_Rel -#define ElfW_Dyn Elf32_Dyn -#define ELFW_R_TYPE ELF32_R_TYPE -#else -#error architecture not supported -#endif #include <sys/exec_elf.h> -#if defined(__aarch64__) -#define RELOC_TYPE_NONE R_AARCH64_NONE -#define RELOC_TYPE_RELATIVE R_AARCH64_RELATIVE -#elif defined(__amd64__) #define RELOC_TYPE_NONE R_X86_64_NONE #define RELOC_TYPE_RELATIVE R_X86_64_RELATIVE -#elif defined(__arm__) -#define RELOC_TYPE_NONE R_ARM_NONE -#define RELOC_TYPE_RELATIVE R_ARM_RELATIVE -#elif defined(__i386__) -#define RELOC_TYPE_NONE R_386_NONE -#define RELOC_TYPE_RELATIVE R_386_RELATIVE -#endif /* * A simple elf relocator. diff --git a/sys/arch/amd64/stand/efi64/start_i386.S b/sys/arch/amd64/stand/efi64/start_i386.S deleted file mode 100644 index 016ab93d15a..00000000000 --- a/sys/arch/amd64/stand/efi64/start_i386.S +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * Copyright (c) 2008-2010 Rui Paulo <rpaulo@FreeBSD.org> - * 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: head/sys/boot/efi/loader/arch/i386/start.S 282728 2015-05-10 13:30:21Z ian $ - */ - - .text - -#include <machine/asm.h> - -#define EFI_SUCCESS 0 - -/* - * EFI entry point. - * _start(EFI_IMAGE image_handle, EFI_SYSTEM_TABLE *system_table); - * - * We calculate the base address along with _DYNAMIC, relocate us and finally - * pass control to efi_main. - */ - -ENTRY(_start) - pushl %ebp - movl %esp, %ebp - - pushl 12(%ebp) /* image_handle */ - pushl 8(%ebp) /* system_table */ - call 0f -0: popl %eax - movl %eax, %ebx - addl $ImageBase-0b, %eax - addl $_DYNAMIC-0b, %ebx - pushl %ebx /* dynamic */ - pushl %eax /* ImageBase */ - call self_reloc - popl %ebx /* remove ImageBase from the stack */ - popl %ebx /* remove dynamic from the stack */ - call efi_main -1: leave - ret -END(_start) - - .data - .section .reloc, "a" - .long 0 - .long 10 - .word 0 |