From owner-svn-src-user@FreeBSD.ORG Mon Jan 5 04:30:23 2015 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5700C78E; Mon, 5 Jan 2015 04:30:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 288FB1783; Mon, 5 Jan 2015 04:30:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t054UNXX066496; Mon, 5 Jan 2015 04:30:23 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t054UMgN066491; Mon, 5 Jan 2015 04:30:22 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201501050430.t054UMgN066491@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Mon, 5 Jan 2015 04:30:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r276687 - user/nwhitehorn/kboot/powerpc/kboot X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jan 2015 04:30:23 -0000 Author: nwhitehorn Date: Mon Jan 5 04:30:21 2015 New Revision: 276687 URL: https://svnweb.freebsd.org/changeset/base/276687 Log: Finish TODOs. This boots a functioning kernel on PS3 -- and one that can print Hello World on POWER8. Modified: user/nwhitehorn/kboot/powerpc/kboot/kerneltramp.S user/nwhitehorn/kboot/powerpc/kboot/ppc64_elf_freebsd.c Modified: user/nwhitehorn/kboot/powerpc/kboot/kerneltramp.S ============================================================================== --- user/nwhitehorn/kboot/powerpc/kboot/kerneltramp.S Mon Jan 5 03:27:09 2015 (r276686) +++ user/nwhitehorn/kboot/powerpc/kboot/kerneltramp.S Mon Jan 5 04:30:21 2015 (r276687) @@ -3,13 +3,12 @@ * * The goal here is to call the actual kernel entry point with the arguments it * expects when kexec calls into it with no arguments. The value of the kernel - * entry point and arguments r3-r7 are copied into the trampoline text (which can - * be executed from any address) at bytes 8-32. + * entry point and arguments r3-r7 are copied into the trampoline text (which + * can be executed from any address) at bytes 8-32. kexec begins execution + * of APs at 0x60 bytes past the entry point, executing in a copy relocated + * to the absolute address 0x60. Here we implement a loop waiting on the release + * of a lock by the kernel at 0x40. * - * TODO: - * - This may or may not need to relocate the kernel before executing it - * - kexec enters at address 0x60 for all APs. We need to catch these and hold - * them. */ #include @@ -17,9 +16,26 @@ .globl CNAME(kerneltramp),CNAME(szkerneltramp) CNAME(kerneltramp): mflr %r9 - bl 1f + bl 2f .space 24 /* branch address, r3-r7 */ -1: + +. = kerneltramp + 0x40 /* AP spinlock */ + .long 0 + +. = kerneltramp + 0x60 /* AP entry point */ + li %r3,0x40 +1: lwz %r1,0(%r3) + cmpwi %r1,0 + beq 1b + + /* Jump into CPU reset */ + li %r0,0x100 + icbi 0,%r0 + isync + sync + ba 0x100 + +2: /* Continuation of kerneltramp */ mflr %r8 mtlr %r9 lwz %r3,0(%r8) @@ -31,6 +47,7 @@ CNAME(kerneltramp): lwz %r6,16(%r8) lwz %r7,20(%r8) bctr + endkerneltramp: .data Modified: user/nwhitehorn/kboot/powerpc/kboot/ppc64_elf_freebsd.c ============================================================================== --- user/nwhitehorn/kboot/powerpc/kboot/ppc64_elf_freebsd.c Mon Jan 5 03:27:09 2015 (r276686) +++ user/nwhitehorn/kboot/powerpc/kboot/ppc64_elf_freebsd.c Mon Jan 5 04:30:21 2015 (r276687) @@ -68,7 +68,7 @@ ppc64_elf_exec(struct preloaded_file *fp Elf_Ehdr *e; int error; uint32_t *trampoline; - vm_offset_t trampolinebase = 16*1024*1024; /* XXX */ + vm_offset_t trampolinebase = 96*1024*1024; /* XXX */ if ((fmp = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) { return(EFTYPE);