Date: Mon, 5 Jan 2015 04:30:22 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r276687 - user/nwhitehorn/kboot/powerpc/kboot Message-ID: <201501050430.t054UMgN066491@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <machine/asm.h> @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501050430.t054UMgN066491>