summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2017-02-08 09:18:24 +0000
committerpatrick <patrick@openbsd.org>2017-02-08 09:18:24 +0000
commit61bc7149925d63eb48dcd34ea562ee9edfca9b3d (patch)
tree11c73a3b53e57331790c566cc82abd6c5f34b6a5
parentRetry BS->ExitBootServices() if it fails, like on amd64. Also we need (diff)
downloadwireguard-openbsd-61bc7149925d63eb48dcd34ea562ee9edfca9b3d.tar.xz
wireguard-openbsd-61bc7149925d63eb48dcd34ea562ee9edfca9b3d.zip
Pass the physical address to the end of symbols to the kernel. From
armv7 we inherited the mechanism to manually modify the kernel symbol table to change the value of esym. We don't use this, but instead use the virtual address that is passed to the kernel. This change makes us only work on and hand out physical addresses. Bump the efiboot version to make this ABI change more visible.
-rw-r--r--sys/arch/arm64/arm64/locore.S3
-rw-r--r--sys/arch/arm64/stand/efiboot/conf.c4
-rw-r--r--sys/arch/arm64/stand/efiboot/exec.c24
3 files changed, 6 insertions, 25 deletions
diff --git a/sys/arch/arm64/arm64/locore.S b/sys/arch/arm64/arm64/locore.S
index 795120114f8..304017790b3 100644
--- a/sys/arch/arm64/arm64/locore.S
+++ b/sys/arch/arm64/arm64/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.13 2017/02/07 21:56:07 patrick Exp $ */
+/* $OpenBSD: locore.S,v 1.14 2017/02/08 09:18:24 patrick Exp $ */
/*-
* Copyright (c) 2012-2014 Andrew Turner
* All rights reserved.
@@ -84,6 +84,7 @@ _start:
adr x0, .Lesym
ldr x0, [x0]
sub x0, x0, x29
+ add x21, x21, x29
str x21, [x0]
/*
diff --git a/sys/arch/arm64/stand/efiboot/conf.c b/sys/arch/arm64/stand/efiboot/conf.c
index 45b4d4c517a..39c4208867d 100644
--- a/sys/arch/arm64/stand/efiboot/conf.c
+++ b/sys/arch/arm64/stand/efiboot/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.1 2016/12/17 23:38:33 patrick Exp $ */
+/* $OpenBSD: conf.c,v 1.2 2017/02/08 09:18:24 patrick Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -35,7 +35,7 @@
#include "efiboot.h"
#include "efidev.h"
-const char version[] = "0.1";
+const char version[] = "0.2";
int debug = 0;
struct fs_ops file_system[] = {
diff --git a/sys/arch/arm64/stand/efiboot/exec.c b/sys/arch/arm64/stand/efiboot/exec.c
index 6b8782db049..cc282594e03 100644
--- a/sys/arch/arm64/stand/efiboot/exec.c
+++ b/sys/arch/arm64/stand/efiboot/exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec.c,v 1.4 2017/02/05 13:11:06 patrick Exp $ */
+/* $OpenBSD: exec.c,v 1.5 2017/02/08 09:18:24 patrick Exp $ */
/*
* Copyright (c) 2006, 2016 Mark Kettenis
@@ -90,29 +90,9 @@ cpu_inval_icache(void)
void
run_loadfile(u_long *marks, int howto)
{
- Elf_Ehdr *elf = (Elf_Ehdr *)marks[MARK_SYM];
- Elf_Shdr *shp = (Elf_Shdr *)(marks[MARK_SYM] + elf->e_shoff);
- u_long esym = marks[MARK_END] & 0x000fffffff;
- u_long offset = 0;
char args[256];
char *cp;
void *fdt;
- int i;
-
- /*
- * Tell locore.S where the symbol table ends by setting
- * 'esym', which should be the first word in the .data
- * section.
- */
- for (i = 0; i < elf->e_shnum; i++) {
- /* XXX Assume .data is the first writable segment. */
- if (shp[i].sh_flags & SHF_WRITE) {
- /* XXX We have to store the virtual address. */
- esym |= shp[i].sh_addr & 0xffffff8000000000;
- *(u_long *)(LOADADDR(shp[i].sh_addr)) = esym;
- break;
- }
- }
snprintf(args, sizeof(args) - 8, "%s:%s", cmd.bootdev, cmd.image);
cp = args + strlen(args);
@@ -141,7 +121,7 @@ run_loadfile(u_long *marks, int howto)
cpu_flush_dcache((vaddr_t)fdt, fdt_get_size(fdt));
- (*(startfuncp)(marks[MARK_ENTRY]))((void *)esym, 0, fdt);
+ (*(startfuncp)(marks[MARK_ENTRY]))((void *)marks[MARK_END], 0, fdt);
/* NOTREACHED */
}