Date: Sun, 29 Nov 2015 07:16:08 +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: r291442 - in head/sys/powerpc: aim include powerpc Message-ID: <201511290716.tAT7G8vc082671@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <machine/spr.h> #include <machine/asm.h> +#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 <machine/param.h> #include <machine/asm.h> +#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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511290716.tAT7G8vc082671>