From owner-svn-src-head@freebsd.org Tue Dec 1 17:01:28 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA802A3EC08; Tue, 1 Dec 2015 17:01:28 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7601F1DE7; Tue, 1 Dec 2015 17:01:28 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB1H1Rnt018062; Tue, 1 Dec 2015 17:01:27 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB1H1Rbd018059; Tue, 1 Dec 2015 17:01:27 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201512011701.tB1H1Rbd018059@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Tue, 1 Dec 2015 17:01:27 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2015 17:01:28 -0000 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);