1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-06 13:09:50 +00:00

Make ELFv2 powerpc64 kernels build and run. Loader support will come in a

separate commit.
This commit is contained in:
Nathan Whitehorn 2015-11-29 07:16:08 +00:00
parent 466d476aac
commit 7c259020fb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=291442
5 changed files with 27 additions and 4 deletions

View File

@ -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

View File

@ -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; \

View File

@ -972,11 +972,12 @@ cpu_set_upcall(struct thread *td, struct thread *td0)
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;

View File

@ -65,6 +65,10 @@
#include <machine/param.h>
#include <machine/asm.h>
#ifdef _CALL_ELF
.abiversion _CALL_ELF
#endif
TOC_ENTRY(blocked_lock)
/*

View File

@ -143,7 +143,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
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 *p2, struct thread *td2, int flags)
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;