Date: Tue, 1 Dec 2015 17:01:27 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r291598 - in head/sys/boot: ofw/libofw powerpc/kboot powerpc/ps3 Message-ID: <201512011701.tB1H1Rbd018059@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Tue Dec 1 17:01:27 2015 New Revision: 291598 URL: https://svnweb.freebsd.org/changeset/base/291598 Log: Allow loader to load 64-bit ELFv2 PowerPC kernels. Modified: head/sys/boot/ofw/libofw/ppc64_elf_freebsd.c head/sys/boot/powerpc/kboot/ppc64_elf_freebsd.c head/sys/boot/powerpc/ps3/ppc64_elf_freebsd.c Modified: head/sys/boot/ofw/libofw/ppc64_elf_freebsd.c ============================================================================== --- head/sys/boot/ofw/libofw/ppc64_elf_freebsd.c Tue Dec 1 17:00:31 2015 (r291597) +++ head/sys/boot/ofw/libofw/ppc64_elf_freebsd.c Tue Dec 1 17:01:27 2015 (r291598) @@ -77,8 +77,11 @@ ppc64_ofw_elf_exec(struct preloaded_file } e = (Elf_Ehdr *)&fmp->md_data; - /* Handle function descriptor */ - entry = *(uint64_t *)e->e_entry; + /* Handle function descriptor for ELFv1 kernels */ + if ((e->e_flags & 3) == 2) + entry = e->e_entry; + else + entry = *(uint64_t *)e->e_entry; if ((error = md_load64(fp->f_args, &mdp, &dtbp)) != 0) return (error); Modified: head/sys/boot/powerpc/kboot/ppc64_elf_freebsd.c ============================================================================== --- head/sys/boot/powerpc/kboot/ppc64_elf_freebsd.c Tue Dec 1 17:00:31 2015 (r291597) +++ head/sys/boot/powerpc/kboot/ppc64_elf_freebsd.c Tue Dec 1 17:01:27 2015 (r291598) @@ -78,10 +78,15 @@ ppc64_elf_exec(struct preloaded_file *fp /* Figure out where to put it */ trampolinebase = archsw.arch_loadaddr(LOAD_RAW, NULL, 0); - /* Set up interesting values in function descriptor */ + /* Set up loader trampoline */ trampoline = malloc(szkerneltramp); memcpy(trampoline, &kerneltramp, szkerneltramp); - archsw.arch_copyout(e->e_entry + elf64_relocation_offset, &entry, 8); + /* Parse function descriptor for ELFv1 kernels */ + if ((e->e_flags & 3) == 2) + entry = e->e_entry; + else + archsw.arch_copyout(e->e_entry + elf64_relocation_offset, + &entry, 8); trampoline[2] = entry + elf64_relocation_offset; trampoline[4] = 0; /* Phys. mem offset */ trampoline[5] = 0; /* OF entry point */ Modified: head/sys/boot/powerpc/ps3/ppc64_elf_freebsd.c ============================================================================== --- head/sys/boot/powerpc/ps3/ppc64_elf_freebsd.c Tue Dec 1 17:00:31 2015 (r291597) +++ head/sys/boot/powerpc/ps3/ppc64_elf_freebsd.c Tue Dec 1 17:01:27 2015 (r291598) @@ -75,8 +75,11 @@ ppc64_elf_exec(struct preloaded_file *fp } e = (Elf_Ehdr *)&fmp->md_data; - /* Handle function descriptor */ - entry = (void *)(uintptr_t)(*(uint64_t *)e->e_entry); + /* Handle function descriptor for ELFv1 kernels */ + if ((e->e_flags & 3) == 2) + entry = e->e_entry; + else + entry = (void *)(uintptr_t)(*(uint64_t *)e->e_entry); if ((error = md_load64(fp->f_args, &mdp)) != 0) return (error);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512011701.tB1H1Rbd018059>