From 0f4aa31ed5bb793a65055097950da326916e3905 Mon Sep 17 00:00:00 2001 From: mglocker Date: Mon, 12 Jun 2017 18:26:33 +0000 Subject: [PATCH] Backout last change to remove esym .data patching because it breaks boot for e.g. the BBB and the C.H.I.P.; 'panic: initarm: out of memory'. Better solution to be found as discussed with patrick@. ok jsg@ --- sys/arch/armv7/stand/efiboot/exec.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/sys/arch/armv7/stand/efiboot/exec.c b/sys/arch/armv7/stand/efiboot/exec.c index 4a8a434b3af..6eb730b2bbb 100644 --- a/sys/arch/armv7/stand/efiboot/exec.c +++ b/sys/arch/armv7/stand/efiboot/exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.c,v 1.11 2017/06/08 19:40:49 patrick Exp $ */ +/* $OpenBSD: exec.c,v 1.12 2017/06/12 18:26:33 mglocker Exp $ */ /* * Copyright (c) 2006, 2016 Mark Kettenis @@ -35,11 +35,30 @@ typedef void (*startfuncp)(void *, void *, void *) __attribute__ ((noreturn)); 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] & 0x0fffffff; + u_long offset = 0; char args[256]; char *cp; void *fdt; uint32_t board_id = 0; + 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 & 0xf0000000; + *(u_long *)(LOADADDR(shp[i].sh_addr)) = esym; + break; + } + } snprintf(args, sizeof(args) - 8, "%s:%s", cmd.bootdev, cmd.image); cp = args + strlen(args); -- 2.20.1