aboutsummaryrefslogtreecommitdiff
path: root/stand/efi/loader/arch
diff options
context:
space:
mode:
Diffstat (limited to 'stand/efi/loader/arch')
-rw-r--r--stand/efi/loader/arch/amd64/Makefile.inc1
-rw-r--r--stand/efi/loader/arch/amd64/amd64_tramp.S3
-rw-r--r--stand/efi/loader/arch/amd64/elf64_freebsd.c16
-rw-r--r--stand/efi/loader/arch/amd64/exc.S3
-rw-r--r--stand/efi/loader/arch/amd64/ldscript.amd641
-rw-r--r--stand/efi/loader/arch/amd64/start.S1
-rw-r--r--stand/efi/loader/arch/amd64/trap.c40
-rw-r--r--stand/efi/loader/arch/arm/Makefile.inc2
-rw-r--r--stand/efi/loader/arch/arm/exec.c3
-rw-r--r--stand/efi/loader/arch/arm/ldscript.arm1
-rw-r--r--stand/efi/loader/arch/arm/start.S3
-rw-r--r--stand/efi/loader/arch/arm64/Makefile.inc2
-rw-r--r--stand/efi/loader/arch/arm64/exec.c15
-rw-r--r--stand/efi/loader/arch/arm64/ldscript.arm646
-rw-r--r--stand/efi/loader/arch/arm64/start.S48
-rw-r--r--stand/efi/loader/arch/i386/Makefile.inc13
-rw-r--r--stand/efi/loader/arch/i386/elf32_freebsd.c103
-rw-r--r--stand/efi/loader/arch/i386/exec.c49
-rw-r--r--stand/efi/loader/arch/i386/i386_copy.c58
-rw-r--r--stand/efi/loader/arch/i386/ldscript.i38677
-rw-r--r--stand/efi/loader/arch/i386/start.S68
-rw-r--r--stand/efi/loader/arch/riscv/Makefile.inc2
-rw-r--r--stand/efi/loader/arch/riscv/exec.c2
-rw-r--r--stand/efi/loader/arch/riscv/ldscript.riscv1
-rw-r--r--stand/efi/loader/arch/riscv/start.S4
25 files changed, 82 insertions, 440 deletions
diff --git a/stand/efi/loader/arch/amd64/Makefile.inc b/stand/efi/loader/arch/amd64/Makefile.inc
index 0d9e2648cb59..00658b3b8636 100644
--- a/stand/efi/loader/arch/amd64/Makefile.inc
+++ b/stand/efi/loader/arch/amd64/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
SRCS+= amd64_tramp.S \
start.S \
diff --git a/stand/efi/loader/arch/amd64/amd64_tramp.S b/stand/efi/loader/arch/amd64/amd64_tramp.S
index 877705407f92..515ffc5d784d 100644
--- a/stand/efi/loader/arch/amd64/amd64_tramp.S
+++ b/stand/efi/loader/arch/amd64/amd64_tramp.S
@@ -1,6 +1,5 @@
/*-
* Copyright (c) 2013 The FreeBSD Foundation
- * All rights reserved.
*
* This software was developed by Benno Rice under sponsorship from
* the FreeBSD Foundation.
@@ -24,8 +23,6 @@
* 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$
*/
#include <machine/asmacros.h>
diff --git a/stand/efi/loader/arch/amd64/elf64_freebsd.c b/stand/efi/loader/arch/amd64/elf64_freebsd.c
index 4bdf675cd5a3..196efb048064 100644
--- a/stand/efi/loader/arch/amd64/elf64_freebsd.c
+++ b/stand/efi/loader/arch/amd64/elf64_freebsd.c
@@ -26,8 +26,6 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#define __ELF_WORD_SIZE 64
#include <sys/param.h>
#include <sys/exec.h>
@@ -119,12 +117,6 @@ elf64_exec(struct preloaded_file *fp)
/*
* Report the RSDP to the kernel. While this can be found with
* a BIOS boot, the RSDP may be elsewhere when booted from UEFI.
- * The old code used the 'hints' method to communite this to
- * the kernel. However, while convenient, the 'hints' method
- * is fragile and does not work when static hints are compiled
- * into the kernel. Instead, move to setting different tunables
- * that start with acpi. The old 'hints' can be removed before
- * we branch for FreeBSD 12.
*/
rsdp = efi_get_table(&acpi20_guid);
@@ -133,29 +125,23 @@ elf64_exec(struct preloaded_file *fp)
}
if (rsdp != NULL) {
sprintf(buf, "0x%016llx", (unsigned long long)rsdp);
- setenv("hint.acpi.0.rsdp", buf, 1);
setenv("acpi.rsdp", buf, 1);
revision = rsdp->Revision;
if (revision == 0)
revision = 1;
sprintf(buf, "%d", revision);
- setenv("hint.acpi.0.revision", buf, 1);
setenv("acpi.revision", buf, 1);
strncpy(buf, rsdp->OemId, sizeof(rsdp->OemId));
buf[sizeof(rsdp->OemId)] = '\0';
- setenv("hint.acpi.0.oem", buf, 1);
setenv("acpi.oem", buf, 1);
sprintf(buf, "0x%016x", rsdp->RsdtPhysicalAddress);
- setenv("hint.acpi.0.rsdt", buf, 1);
setenv("acpi.rsdt", buf, 1);
if (revision >= 2) {
/* XXX extended checksum? */
sprintf(buf, "0x%016llx",
(unsigned long long)rsdp->XsdtPhysicalAddress);
- setenv("hint.acpi.0.xsdt", buf, 1);
setenv("acpi.xsdt", buf, 1);
sprintf(buf, "%d", rsdp->Length);
- setenv("hint.acpi.0.xsdt_length", buf, 1);
setenv("acpi.xsdt_length", buf, 1);
}
}
@@ -181,7 +167,7 @@ elf64_exec(struct preloaded_file *fp)
trampoline = (void *)trampcode;
if (copy_staging == COPY_STAGING_ENABLE) {
- PT4 = (pml4_entry_t *)0x0000000040000000;
+ PT4 = (pml4_entry_t *)0x0000000040000000; /* 1G */
err = BS->AllocatePages(AllocateMaxAddress, EfiLoaderData, 3,
(EFI_PHYSICAL_ADDRESS *)&PT4);
if (EFI_ERROR(err)) {
diff --git a/stand/efi/loader/arch/amd64/exc.S b/stand/efi/loader/arch/amd64/exc.S
index 0035d4a37e20..940bfa160161 100644
--- a/stand/efi/loader/arch/amd64/exc.S
+++ b/stand/efi/loader/arch/amd64/exc.S
@@ -1,6 +1,5 @@
/*-
* Copyright (c) 2016 The FreeBSD Foundation
- * All rights reserved.
*
* This software was developed by Konstantin Belousov under sponsorship
* from the FreeBSD Foundation.
@@ -25,8 +24,6 @@
* 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$
*/
.macro EH N, err=1
diff --git a/stand/efi/loader/arch/amd64/ldscript.amd64 b/stand/efi/loader/arch/amd64/ldscript.amd64
index 874df9b08f9e..57014aefc025 100644
--- a/stand/efi/loader/arch/amd64/ldscript.amd64
+++ b/stand/efi/loader/arch/amd64/ldscript.amd64
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
OUTPUT_FORMAT("elf64-x86-64-freebsd", "elf64-x86-64-freebsd", "elf64-x86-64-freebsd")
OUTPUT_ARCH(i386:x86-64)
ENTRY(_start)
diff --git a/stand/efi/loader/arch/amd64/start.S b/stand/efi/loader/arch/amd64/start.S
index 774ef4fa7901..34bf166c6501 100644
--- a/stand/efi/loader/arch/amd64/start.S
+++ b/stand/efi/loader/arch/amd64/start.S
@@ -33,7 +33,6 @@
/*
* crt0-efi-x86_64.S - x86_64 EFI startup code.
- * $FreeBSD$
*/
.text
diff --git a/stand/efi/loader/arch/amd64/trap.c b/stand/efi/loader/arch/amd64/trap.c
index e8cf188cf22f..56a3ee67da6f 100644
--- a/stand/efi/loader/arch/amd64/trap.c
+++ b/stand/efi/loader/arch/amd64/trap.c
@@ -1,6 +1,5 @@
/*-
* Copyright (c) 2016 The FreeBSD Foundation
- * All rights reserved.
*
* This software was developed by Konstantin Belousov under sponsorship
* from the FreeBSD Foundation.
@@ -28,8 +27,6 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stand.h>
#include <string.h>
#include <sys/param.h>
@@ -79,11 +76,21 @@ static uint32_t loader_tss; /* Loader TSS segment */
static struct region_descriptor fw_gdt; /* Descriptor of pristine GDT */
static EFI_PHYSICAL_ADDRESS loader_gdt_pa; /* Address of loader shadow GDT */
+struct frame {
+ struct frame *fr_savfp;
+ uintptr_t fr_savpc;
+};
+
void report_exc(struct trapframe *tf);
void
report_exc(struct trapframe *tf)
{
+ struct frame *fp;
+ uintptr_t pc, base;
+ char buf[80];
+ int ret;
+ base = (uintptr_t)boot_img->ImageBase;
/*
* printf() depends on loader runtime and UEFI firmware health
* to produce the console output, in case of exception, the
@@ -109,6 +116,33 @@ report_exc(struct trapframe *tf)
tf->tf_rdi, tf->tf_rsi, tf->tf_rdx, tf->tf_rcx, tf->tf_r8,
tf->tf_r9, tf->tf_rax, tf->tf_rbx, tf->tf_rbp, tf->tf_r10,
tf->tf_r11, tf->tf_r12, tf->tf_r13, tf->tf_r14, tf->tf_r15);
+
+ fp = (struct frame *)tf->tf_rbp;
+ pc = tf->tf_rip;
+
+ printf("Stack trace:\n");
+ pager_open();
+ while (fp != NULL || pc != 0) {
+ char *source = "PC";
+
+ if (pc >= base && pc < base + boot_img->ImageSize) {
+ pc -= base;
+ source = "loader PC";
+ }
+ (void) snprintf(buf, sizeof (buf), "FP %016lx: %s 0x%016lx\n",
+ (uintptr_t)fp, source, pc);
+ if (pager_output(buf))
+ break;
+
+ if (fp != NULL)
+ fp = fp->fr_savfp;
+
+ if (fp != NULL)
+ pc = fp->fr_savpc;
+ else
+ pc = 0;
+ }
+ pager_close();
printf("Machine stopped.\n");
}
diff --git a/stand/efi/loader/arch/arm/Makefile.inc b/stand/efi/loader/arch/arm/Makefile.inc
index 284e517bfbb8..5761c8062117 100644
--- a/stand/efi/loader/arch/arm/Makefile.inc
+++ b/stand/efi/loader/arch/arm/Makefile.inc
@@ -1,7 +1,5 @@
-# $FreeBSD$
SRCS+= exec.c \
- efiserialio.c \
start.S
HAVE_FDT=yes
diff --git a/stand/efi/loader/arch/arm/exec.c b/stand/efi/loader/arch/arm/exec.c
index a110f3d07cbc..99ee498b1b65 100644
--- a/stand/efi/loader/arch/arm/exec.c
+++ b/stand/efi/loader/arch/arm/exec.c
@@ -26,8 +26,6 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/linker.h>
@@ -43,7 +41,6 @@ __FBSDID("$FreeBSD$");
#include "bootstrap.h"
#include "loader_efi.h"
-extern vm_offset_t md_load(char *, vm_offset_t *);
extern int bi_load(char *, vm_offset_t *, vm_offset_t *, bool);
static int
diff --git a/stand/efi/loader/arch/arm/ldscript.arm b/stand/efi/loader/arch/arm/ldscript.arm
index 68775a88a9cd..13affe12bbba 100644
--- a/stand/efi/loader/arch/arm/ldscript.arm
+++ b/stand/efi/loader/arch/arm/ldscript.arm
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
OUTPUT_ARCH(arm)
ENTRY(_start)
SECTIONS
diff --git a/stand/efi/loader/arch/arm/start.S b/stand/efi/loader/arch/arm/start.S
index 5b6182d67d0a..5e4301ec7141 100644
--- a/stand/efi/loader/arch/arm/start.S
+++ b/stand/efi/loader/arch/arm/start.S
@@ -22,8 +22,6 @@
* 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$
*/
#include <machine/asm.h>
@@ -140,6 +138,7 @@ section_table:
_end_header:
.text
+ .globl _start
_start:
/* Save the boot params to the stack */
push {r0, r1}
diff --git a/stand/efi/loader/arch/arm64/Makefile.inc b/stand/efi/loader/arch/arm64/Makefile.inc
index 9978d9c4ea9c..d19a23af0e9e 100644
--- a/stand/efi/loader/arch/arm64/Makefile.inc
+++ b/stand/efi/loader/arch/arm64/Makefile.inc
@@ -1,9 +1,7 @@
-# $FreeBSD$
HAVE_FDT=yes
SRCS+= exec.c \
- efiserialio.c \
start.S
.PATH: ${BOOTSRC}/arm64/libarm64
diff --git a/stand/efi/loader/arch/arm64/exec.c b/stand/efi/loader/arch/arm64/exec.c
index 6cf4a4fd8e4d..09be15b2b6f3 100644
--- a/stand/efi/loader/arch/arm64/exec.c
+++ b/stand/efi/loader/arch/arm64/exec.c
@@ -25,8 +25,6 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stand.h>
#include <string.h>
@@ -81,6 +79,13 @@ elf64_exec(struct preloaded_file *fp)
int err, revision;
void (*entry)(vm_offset_t);
+ /*
+ * Report the RSDP to the kernel. The old code used the 'hints' method
+ * to communicate this to the kernel, but this is now considered legacy.
+ * Instead, move to setting different tunables that start with acpi.
+ * The old 'hints' can be removed before we branch for FreeBSD 15.
+ */
+
rsdp = efi_get_table(&acpi20_guid);
if (rsdp == NULL) {
rsdp = efi_get_table(&acpi_guid);
@@ -88,23 +93,29 @@ elf64_exec(struct preloaded_file *fp)
if (rsdp != NULL) {
sprintf(buf, "0x%016llx", (unsigned long long)rsdp);
setenv("hint.acpi.0.rsdp", buf, 1);
+ setenv("acpi.rsdp", buf, 1);
revision = rsdp->Revision;
if (revision == 0)
revision = 1;
sprintf(buf, "%d", revision);
setenv("hint.acpi.0.revision", buf, 1);
+ setenv("acpi.revision", buf, 1);
strncpy(buf, rsdp->OemId, sizeof(rsdp->OemId));
buf[sizeof(rsdp->OemId)] = '\0';
setenv("hint.acpi.0.oem", buf, 1);
+ setenv("acpi.oem", buf, 1);
sprintf(buf, "0x%016x", rsdp->RsdtPhysicalAddress);
setenv("hint.acpi.0.rsdt", buf, 1);
+ setenv("acpi.rsdt", buf, 1);
if (revision >= 2) {
/* XXX extended checksum? */
sprintf(buf, "0x%016llx",
(unsigned long long)rsdp->XsdtPhysicalAddress);
setenv("hint.acpi.0.xsdt", buf, 1);
+ setenv("acpi.xsdt", buf, 1);
sprintf(buf, "%d", rsdp->Length);
setenv("hint.acpi.0.xsdt_length", buf, 1);
+ setenv("acpi.xsdt_length", buf, 1);
}
}
diff --git a/stand/efi/loader/arch/arm64/ldscript.arm64 b/stand/efi/loader/arch/arm64/ldscript.arm64
index d0ed320a319c..bacb81b5032f 100644
--- a/stand/efi/loader/arch/arm64/ldscript.arm64
+++ b/stand/efi/loader/arch/arm64/ldscript.arm64
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/*
OUTPUT_FORMAT("elf64-aarch64-freebsd", "elf64-aarch64-freebsd", "elf64-aarch64-freebsd")
*/
@@ -16,7 +15,9 @@ SECTIONS
*(.gnu.warning)
*(.plt)
} =0xD4200000
- . = ALIGN(16);
+ . = ALIGN(4096);
+ _etext = .;
+ __data_start = .;
.data : {
*(.rodata .rodata.* .gnu.linkonce.r.*)
*(.rodata1)
@@ -78,6 +79,7 @@ SECTIONS
. = ALIGN(16);
.dynsym : { *(.dynsym) }
_edata = .;
+ __data_size = . - __data_start;
/* Unused sections */
.interp : { *(.interp) }
diff --git a/stand/efi/loader/arch/arm64/start.S b/stand/efi/loader/arch/arm64/start.S
index 675d4e153f36..6e30287453c5 100644
--- a/stand/efi/loader/arch/arm64/start.S
+++ b/stand/efi/loader/arch/arm64/start.S
@@ -22,8 +22,6 @@
* 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$
*/
/*
@@ -34,11 +32,14 @@
#define IMAGE_FILE_MACHINE_ARM64 0xaa64
+#define IMAGE_FILE_EXECUTABLE 0x0002
+
#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
+#define IMAGE_SCN_MEM_WRITE 0x80000000
.section .peheader,"a"
efi_start:
@@ -60,22 +61,22 @@ coff_head:
.long 0 /* No symbol table */
.long 0 /* No symbols */
.short section_table - optional_header /* Optional header size */
- .short 0 /* Characteristics TODO: Fill in */
+ .short IMAGE_FILE_EXECUTABLE /* Characteristics */
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 _etext - _end_header /* Code size */
+ .long __data_size /* Initialized data size */
.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 */
+ .long 4096 /* Section Alignment */
+ .long 512 /* File alignment */
.short 0 /* Major OS version */
.short 0 /* Minor OS version */
.short 0 /* Major image version */
@@ -104,36 +105,37 @@ optional_windows_header:
.quad 0
section_table:
- /* We need a .reloc section for EFI */
- .ascii ".reloc"
+ .ascii ".text"
+ .byte 0
.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 _etext - _end_header /* Virtual size */
+ .long _end_header - efi_start /* Virtual address */
+ .long _etext - _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_INITIALIZED_DATA | IMAGE_SCN_MEM_READ | \
- IMAGE_SCN_MEM_DISCARDABLE) /* Characteristics */
+ .long (IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE | \
+ IMAGE_SCN_MEM_READ) /* Characteristics */
- /* The contents of the loader */
- .ascii ".text"
+ .ascii ".data"
.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 __data_size /* Virtual size */
+ .long __data_start - efi_start /* Virtual address */
+ .long __data_size /* Size of raw data */
+ .long __data_start - 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 */
+ .long (IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ | \
+ IMAGE_SCN_MEM_WRITE) /* Characteristics */
+
+ .align 12
_end_header:
.text
diff --git a/stand/efi/loader/arch/i386/Makefile.inc b/stand/efi/loader/arch/i386/Makefile.inc
deleted file mode 100644
index fcdb6324b2f0..000000000000
--- a/stand/efi/loader/arch/i386/Makefile.inc
+++ /dev/null
@@ -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
diff --git a/stand/efi/loader/arch/i386/elf32_freebsd.c b/stand/efi/loader/arch/i386/elf32_freebsd.c
deleted file mode 100644
index 97d114f09610..000000000000
--- a/stand/efi/loader/arch/i386/elf32_freebsd.c
+++ /dev/null
@@ -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);
-}
diff --git a/stand/efi/loader/arch/i386/exec.c b/stand/efi/loader/arch/i386/exec.c
deleted file mode 100644
index 579f5593b24b..000000000000
--- a/stand/efi/loader/arch/i386/exec.c
+++ /dev/null
@@ -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, ...)
-{
-}
diff --git a/stand/efi/loader/arch/i386/i386_copy.c b/stand/efi/loader/arch/i386/i386_copy.c
deleted file mode 100644
index 2c4b0deb49cf..000000000000
--- a/stand/efi/loader/arch/i386/i386_copy.c
+++ /dev/null
@@ -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));
-}
diff --git a/stand/efi/loader/arch/i386/ldscript.i386 b/stand/efi/loader/arch/i386/ldscript.i386
deleted file mode 100644
index e17212a1bddd..000000000000
--- a/stand/efi/loader/arch/i386/ldscript.i386
+++ /dev/null
@@ -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) }
-}
diff --git a/stand/efi/loader/arch/i386/start.S b/stand/efi/loader/arch/i386/start.S
deleted file mode 100644
index b597f419d4a1..000000000000
--- a/stand/efi/loader/arch/i386/start.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$
- */
-
- .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
diff --git a/stand/efi/loader/arch/riscv/Makefile.inc b/stand/efi/loader/arch/riscv/Makefile.inc
index 333b789e935d..c25f63c0b3b7 100644
--- a/stand/efi/loader/arch/riscv/Makefile.inc
+++ b/stand/efi/loader/arch/riscv/Makefile.inc
@@ -1,7 +1,5 @@
-# $FreeBSD$
HAVE_FDT=yes
SRCS+= exec.c \
- efiserialio.c \
start.S
diff --git a/stand/efi/loader/arch/riscv/exec.c b/stand/efi/loader/arch/riscv/exec.c
index c7d90a4f31d0..686a42028608 100644
--- a/stand/efi/loader/arch/riscv/exec.c
+++ b/stand/efi/loader/arch/riscv/exec.c
@@ -26,8 +26,6 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/linker.h>
diff --git a/stand/efi/loader/arch/riscv/ldscript.riscv b/stand/efi/loader/arch/riscv/ldscript.riscv
index aa736f0d9b2a..342ec62cf03e 100644
--- a/stand/efi/loader/arch/riscv/ldscript.riscv
+++ b/stand/efi/loader/arch/riscv/ldscript.riscv
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
OUTPUT_FORMAT("elf64-littleriscv", "elf64-littleriscv", "elf64-littleriscv")
OUTPUT_ARCH(riscv64)
ENTRY(_start)
diff --git a/stand/efi/loader/arch/riscv/start.S b/stand/efi/loader/arch/riscv/start.S
index e63ce68d86ba..fb7d65f17c99 100644
--- a/stand/efi/loader/arch/riscv/start.S
+++ b/stand/efi/loader/arch/riscv/start.S
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2020 Mitchell Horne <mhorne@FreeBSD.org>
*
@@ -23,8 +23,6 @@
* 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$
*/
#include <machine/asm.h>