stand/efi: Retire i386 support

Remove the i386 ifdefs and files. It never worked.

Sponsored by:		Netflix
Reviewed by:		manu, tsoome, kevans
Differential Revision:	https://reviews.freebsd.org/D40012
This commit is contained in:
Warner Losh 2023-05-11 14:04:12 -06:00
parent ad9d10a859
commit c16e08e5f3
11 changed files with 12 additions and 388 deletions

View File

@ -21,8 +21,6 @@ CFLAGS+= -fPIC
.if ${MACHINE_CPUARCH} == "amd64"
EFI_TARGET= efi-app-x86_64
.elif ${MACHINE_CPUARCH} == "i386"
EFI_TARGET= efi-app-ia32
.else
EFI_TARGET= binary
.endif

View File

@ -74,7 +74,7 @@ LDFLAGS+= -Wl,--no-dynamic-linker
.if ${MACHINE_CPUARCH} == "aarch64"
CFLAGS+= -mgeneral-regs-only
.endif
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
.if ${MACHINE_CPUARCH} == "amd64"
CFLAGS+= -fPIC
LDFLAGS+= -Wl,-znocombreloc
.endif
@ -82,9 +82,8 @@ LDFLAGS+= -Wl,-znocombreloc
LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a
#
# Add libsa 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.
# Add libsa for the runtime functions used by the compiler as well as required
# string and memory functions for all platforms.
#
DPADD+= ${LIBEFI} ${LIBSA}
LDADD+= ${LIBEFI} ${LIBSA}

View File

@ -26,7 +26,7 @@ SRCS= delay.c \
.PATH: ${SYSDIR}/teken
SRCS+= teken.c
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
.if ${MACHINE_CPUARCH} == "amd64"
SRCS+= time.c
.elif ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "riscv"
SRCS+= time_event.c

View File

@ -1,13 +0,0 @@
# $FreeBSD$
SRCS+= start.S \
elf32_freebsd.c \
exec.c
.PATH: ${BOOTSRC}/i386/libi386
SRCS+= nullconsole.c \
comconsole.c \
spinconsole.c
CFLAGS+= -fPIC
LDFLAGS+= -Wl,-znocombreloc

View File

@ -1,103 +0,0 @@
/*-
* Copyright (c) 1998 Michael Smith <msmith@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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/exec.h>
#include <sys/linker.h>
#include <string.h>
#include <machine/bootinfo.h>
#include <machine/elf.h>
#include <stand.h>
#include <efi.h>
#include <efilib.h>
#include "bootstrap.h"
#include "../libi386/libi386.h"
#include "../btx/lib/btxv86.h"
extern void __exec(caddr_t addr, ...);
extern int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp,
bool exit_bs);
static int elf32_exec(struct preloaded_file *amp);
static int elf32_obj_exec(struct preloaded_file *amp);
struct file_format i386_elf = { elf32_loadfile, elf32_exec };
struct file_format i386_elf_obj = { elf32_obj_loadfile, elf32_obj_exec };
struct file_format *file_formats[] = {
&i386_elf,
&i386_elf_obj,
NULL
};
/*
* There is an ELF kernel and one or more ELF modules loaded.
* We wish to start executing the kernel image, so make such
* preparations as are required, and do so.
*/
static int
elf32_exec(struct preloaded_file *fp)
{
struct file_metadata *md;
Elf_Ehdr *ehdr;
vm_offset_t entry, bootinfop, modulep, kernend;
int boothowto, err, bootdev;
if ((md = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL)
return(EFTYPE);
ehdr = (Elf_Ehdr *)&(md->md_data);
efi_time_fini();
entry = ehdr->e_entry & 0xffffff;
printf("Start @ 0x%x ...\n", entry);
err = bi_load(fp->f_args, &modulep, &kernend, true);
if (err != 0) {
efi_time_init();
return(err);
}
/* At this point we've called ExitBootServices, so we can't call
* printf or any other function that uses Boot Services */
dev_cleanup();
__exec((void *)entry, boothowto, bootdev, 0, 0, 0, bootinfop, modulep, kernend);
panic("exec returned");
}
static int
elf32_obj_exec(struct preloaded_file *fp)
{
return (EFTYPE);
}

View File

@ -1,49 +0,0 @@
/*-
* Copyright (c) 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 ``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 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <stand.h>
#include <machine/elf.h>
#include "../btx/lib/btxv86.h"
#include "../../common/bootstrap.h"
uint32_t __base;
struct __v86 __v86;
void
__v86int()
{
printf("%s\n", __func__);
exit(1);
}
void
__exec(caddr_t addr, ...)
{
}

View File

@ -1,58 +0,0 @@
/*-
* Copyright (c) 1998 Michael Smith <msmith@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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
/*
* MD primitives supporting placement of module data
*
* XXX should check load address/size against memory top.
*/
#include <stand.h>
#include "libi386.h"
#include "btxv86.h"
ssize_t
i386_copyin(const void *src, vm_offset_t dest, const size_t len)
{
bcopy(src, PTOV(dest), len);
return(len);
}
ssize_t
i386_copyout(const vm_offset_t src, void *dest, const size_t len)
{
bcopy(PTOV(src), dest, len);
return(len);
}
ssize_t
i386_readin(readin_handle_t fd, vm_offset_t dest, const size_t len)
{
return (VECTX_READ(fd, PTOV(dest), len));
}

View File

@ -1,77 +0,0 @@
/* $FreeBSD$ */
OUTPUT_FORMAT("elf32-i386-freebsd", "elf32-i386-freebsd", "elf32-i386-freebsd")
OUTPUT_ARCH(i386)
ENTRY(_start)
SECTIONS
{
/* Read-only sections, merged into text segment: */
. = 0;
ImageBase = .;
. = SIZEOF_HEADERS;
. = ALIGN(4096);
.text : {
*(.text .stub .text.* .gnu.linkonce.t.*)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.plt)
} =0xCCCCCCCC
. = ALIGN(4096);
.data : {
*(.rodata .rodata.* .gnu.linkonce.r.*)
*(.rodata1)
*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
*(.opd)
*(.data .data.* .gnu.linkonce.d.*)
*(.data1)
*(.plabel)
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
}
. = ALIGN(4096);
set_Xcommand_set : {
__start_set_Xcommand_set = .;
*(set_Xcommand_set)
__stop_set_Xcommand_set = .;
}
set_Xficl_compile_set : {
__start_set_Xficl_compile_set = .;
*(set_Xficl_compile_set)
__stop_set_Xficl_compile_set = .;
}
. = ALIGN(4096);
__gp = .;
.sdata : {
*(.got.plt .got)
*(.sdata .sdata.* .gnu.linkonce.s.*)
*(dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon)
}
. = ALIGN(4096);
.dynamic : { *(.dynamic) }
. = ALIGN(4096);
.rel.dyn : {
*(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
*(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
*(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
*(.rel.got)
*(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
*(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
*(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
*(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
*(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
*(.rel.plt)
*(.relset_*)
*(.rel.dyn .rel.dyn.*)
}
. = ALIGN(4096);
.reloc : { *(.reloc) }
. = ALIGN(4096);
.hash : { *(.hash) }
. = ALIGN(4096);
.dynsym : { *(.dynsym) }
. = ALIGN(4096);
.dynstr : { *(.dynstr) }
}

View File

@ -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$
*/
.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

View File

@ -85,7 +85,7 @@ extern struct console eficom;
/* Hack for backward compatibility -- but only for a while */
extern struct console comconsole;
#endif
#if defined(__amd64__) || defined(__i386__)
#if defined(__amd64__)
extern struct console comconsole;
extern struct console nullconsole;
extern struct console spinconsole;
@ -97,7 +97,7 @@ struct console *consoles[] = {
#if defined(__aarch64__) && __FreeBSD_version < 1500000
&comconsole,
#endif
#if defined(__amd64__) || defined(__i386__)
#if defined(__amd64__)
&comconsole,
&nullconsole,
&spinconsole,

View File

@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$");
#define M(x) ((x) * 1024 * 1024)
#define G(x) (1UL * (x) * 1024 * 1024 * 1024)
#if defined(__i386__) || defined(__amd64__)
#if defined(__amd64__)
#include <machine/cpufunc.h>
#include <machine/specialreg.h>
#include <machine/vmparam.h>
@ -173,7 +173,7 @@ efi_verify_staging_size(unsigned long *nr_pages)
out:
free(map);
}
#endif /* __i386__ || __amd64__ */
#endif /* __amd64__ */
#if defined(__arm__)
#define DEFAULT_EFI_STAGING_SIZE 32
@ -284,7 +284,7 @@ command_staging_slop(int argc, char *argv[])
COMMAND_SET(staging_slop, "staging_slop", "set staging slop",
command_staging_slop);
#if defined(__i386__) || defined(__amd64__)
#if defined(__amd64__)
/*
* The staging area must reside in the first 1GB or 4GB physical
* memory: see elf64_exec() in
@ -295,11 +295,7 @@ get_staging_max(void)
{
EFI_PHYSICAL_ADDRESS res;
#if defined(__i386__)
res = G(1);
#elif defined(__amd64__)
res = copy_staging == COPY_STAGING_ENABLE ? G(1) : G(4);
#endif
return (res);
}
#define EFI_ALLOC_METHOD AllocateMaxAddress
@ -319,7 +315,7 @@ efi_copy_init(void)
ess = DEFAULT_EFI_STAGING_SIZE;
nr_pages = EFI_SIZE_TO_PAGES(M(1) * ess);
#if defined(__i386__) || defined(__amd64__)
#if defined(__amd64__)
/*
* We'll decrease nr_pages, if it's too big. Currently we only
* apply this to FreeBSD VM running on Hyper-V. Why? Please see
@ -387,9 +383,8 @@ efi_check_space(vm_offset_t end)
end += staging_slop;
nr_pages = EFI_SIZE_TO_PAGES(end - staging_end);
#if defined(__i386__) || defined(__amd64__)
#if defined(__amd64__)
/*
* i386 needs all memory to be allocated under the 1G boundary.
* amd64 needs all memory to be allocated under the 1G or 4G boundary.
*/
if (end > get_staging_max())
@ -435,7 +430,7 @@ efi_check_space(vm_offset_t end)
#if EFI_STAGING_2M_ALIGN
nr_pages += M(2) / EFI_PAGE_SIZE;
#endif
#if defined(__i386__) || defined(__amd64__)
#if defined(__amd64__)
new_base = get_staging_max();
#endif
status = BS->AllocatePages(EFI_ALLOC_METHOD, EfiLoaderCode,