From owner-svn-src-head@freebsd.org Sun Nov 29 07:16:10 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 5980DA3CFEB; Sun, 29 Nov 2015 07:16:10 +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 33596125E; Sun, 29 Nov 2015 07:16:10 +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 tAT7G90d082677; Sun, 29 Nov 2015 07:16:09 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAT7G8vc082671; Sun, 29 Nov 2015 07:16:08 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201511290716.tAT7G8vc082671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Sun, 29 Nov 2015 07:16:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r291442 - in head/sys/powerpc: aim include powerpc 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: Sun, 29 Nov 2015 07:16:10 -0000 Author: nwhitehorn Date: Sun Nov 29 07:16:08 2015 New Revision: 291442 URL: https://svnweb.freebsd.org/changeset/base/291442 Log: Make ELFv2 powerpc64 kernels build and run. Loader support will come in a separate commit. Modified: head/sys/powerpc/aim/locore64.S head/sys/powerpc/include/asm.h head/sys/powerpc/powerpc/exec_machdep.c head/sys/powerpc/powerpc/swtch64.S head/sys/powerpc/powerpc/vm_machdep.c Modified: head/sys/powerpc/aim/locore64.S ============================================================================== --- head/sys/powerpc/aim/locore64.S Sun Nov 29 06:40:09 2015 (r291441) +++ head/sys/powerpc/aim/locore64.S Sun Nov 29 07:16:08 2015 (r291442) @@ -65,6 +65,10 @@ #include #include +#ifdef _CALL_ELF +.abiversion _CALL_ELF +#endif + /* Locate the per-CPU data structure */ #define GET_CPUINFO(r) \ mfsprg0 r Modified: head/sys/powerpc/include/asm.h ============================================================================== --- head/sys/powerpc/include/asm.h Sun Nov 29 06:40:09 2015 (r291441) +++ head/sys/powerpc/include/asm.h Sun Nov 29 07:16:08 2015 (r291442) @@ -87,7 +87,9 @@ .tc name[TC],name #endif -#if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1) +#ifdef __powerpc64__ + +#if !defined(_CALL_ELF) || _CALL_ELF == 1 #define _ENTRY(name) \ .section ".text"; \ .p2align 2; \ @@ -100,6 +102,17 @@ .p2align 4; \ TYPE_ENTRY(name) \ DOT_LABEL(name): +#else +#define _ENTRY(name) \ + .text; \ + .p2align 4; \ + .globl name; \ + .type name,@function; \ +name: \ + addis %r2, %r12, (.TOC.-name)@ha; \ + addi %r2, %r2, (.TOC.-name)@l; \ + .localentry name, .-name; +#endif #define _END(name) \ .long 0; \ Modified: head/sys/powerpc/powerpc/exec_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/exec_machdep.c Sun Nov 29 06:40:09 2015 (r291441) +++ head/sys/powerpc/powerpc/exec_machdep.c Sun Nov 29 07:16:08 2015 (r291442) @@ -972,11 +972,12 @@ cpu_set_upcall(struct thread *td, struct cf->cf_arg1 = (register_t)tf; pcb2->pcb_sp = (register_t)cf; - #ifdef __powerpc64__ + #if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1) pcb2->pcb_lr = ((register_t *)fork_trampoline)[0]; pcb2->pcb_toc = ((register_t *)fork_trampoline)[1]; #else pcb2->pcb_lr = (register_t)fork_trampoline; + pcb2->pcb_context[0] = pcb2->pcb_lr; #endif pcb2->pcb_cpu.aim.usr_vsid = 0; Modified: head/sys/powerpc/powerpc/swtch64.S ============================================================================== --- head/sys/powerpc/powerpc/swtch64.S Sun Nov 29 06:40:09 2015 (r291441) +++ head/sys/powerpc/powerpc/swtch64.S Sun Nov 29 07:16:08 2015 (r291442) @@ -65,6 +65,10 @@ #include #include +#ifdef _CALL_ELF +.abiversion _CALL_ELF +#endif + TOC_ENTRY(blocked_lock) /* Modified: head/sys/powerpc/powerpc/vm_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/vm_machdep.c Sun Nov 29 06:40:09 2015 (r291441) +++ head/sys/powerpc/powerpc/vm_machdep.c Sun Nov 29 07:16:08 2015 (r291442) @@ -143,7 +143,7 @@ cpu_fork(struct thread *td1, struct proc cf = (struct callframe *)tf - 1; memset(cf, 0, sizeof(struct callframe)); - #ifdef __powerpc64__ + #if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1) cf->cf_toc = ((register_t *)fork_return)[1]; #endif cf->cf_func = (register_t)fork_return; @@ -152,11 +152,12 @@ cpu_fork(struct thread *td1, struct proc pcb->pcb_sp = (register_t)cf; KASSERT(pcb->pcb_sp % 16 == 0, ("stack misaligned")); - #ifdef __powerpc64__ + #if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1) pcb->pcb_lr = ((register_t *)fork_trampoline)[0]; pcb->pcb_toc = ((register_t *)fork_trampoline)[1]; #else pcb->pcb_lr = (register_t)fork_trampoline; + pcb->pcb_context[0] = pcb->pcb_lr; #endif #ifdef AIM pcb->pcb_cpu.aim.usr_vsid = 0;