Changeset View
Changeset View
Standalone View
Standalone View
sys/powerpc/powerpc/elf32_machdep.c
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
#include <sys/vnode.h> | #include <sys/vnode.h> | ||||
#include <sys/linker.h> | #include <sys/linker.h> | ||||
#include <vm/vm.h> | #include <vm/vm.h> | ||||
#include <vm/vm_param.h> | #include <vm/vm_param.h> | ||||
#include <machine/altivec.h> | #include <machine/altivec.h> | ||||
#include <machine/cpu.h> | #include <machine/cpu.h> | ||||
#include <machine/fpu.h> | |||||
#include <machine/elf.h> | #include <machine/elf.h> | ||||
#include <machine/reg.h> | #include <machine/reg.h> | ||||
#include <machine/md_var.h> | #include <machine/md_var.h> | ||||
#ifdef __powerpc64__ | #ifdef __powerpc64__ | ||||
#include <compat/freebsd32/freebsd32_proto.h> | #include <compat/freebsd32/freebsd32_proto.h> | ||||
#include <compat/freebsd32/freebsd32_util.h> | #include <compat/freebsd32/freebsd32_util.h> | ||||
▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | |||||
void elf_reloc_self(Elf_Dyn *dynp, Elf_Addr relocbase); | void elf_reloc_self(Elf_Dyn *dynp, Elf_Addr relocbase); | ||||
void | void | ||||
elf32_dump_thread(struct thread *td, void *dst, size_t *off) | elf32_dump_thread(struct thread *td, void *dst, size_t *off) | ||||
{ | { | ||||
size_t len; | size_t len; | ||||
struct pcb *pcb; | struct pcb *pcb; | ||||
uint64_t vshr[32]; | |||||
uint64_t *vsr_dw1; | |||||
int vsr_idx; | |||||
len = 0; | len = 0; | ||||
pcb = td->td_pcb; | pcb = td->td_pcb; | ||||
if (pcb->pcb_flags & PCB_VEC) { | if (pcb->pcb_flags & PCB_VEC) { | ||||
save_vec_nodrop(td); | save_vec_nodrop(td); | ||||
if (dst != NULL) { | if (dst != NULL) { | ||||
len += elf32_populate_note(NT_PPC_VMX, | len += elf32_populate_note(NT_PPC_VMX, | ||||
&pcb->pcb_vec, dst, | &pcb->pcb_vec, (char *)dst + len, | ||||
sizeof(pcb->pcb_vec), NULL); | sizeof(pcb->pcb_vec), NULL); | ||||
} else | } else | ||||
len += elf32_populate_note(NT_PPC_VMX, NULL, NULL, | len += elf32_populate_note(NT_PPC_VMX, NULL, NULL, | ||||
sizeof(pcb->pcb_vec), NULL); | sizeof(pcb->pcb_vec), NULL); | ||||
} | } | ||||
if (pcb->pcb_flags & PCB_VSX) { | |||||
save_fpu_nodrop(td); | |||||
if (dst != NULL) { | |||||
/* | |||||
* Doubleword 0 of VSR0-VSR31 overlap with FPR0-FPR31 and | |||||
* VSR32-VSR63 overlap with VR0-VR31, so we only copy | |||||
* the non-overlapping data, which is doubleword 1 of VSR0-VSR31. | |||||
*/ | |||||
for (vsr_idx = 0; vsr_idx < nitems(vshr); vsr_idx++) { | |||||
vsr_dw1 = (uint64_t *)&pcb->pcb_fpu.fpr[vsr_idx].vsr[2]; | |||||
vshr[vsr_idx] = *vsr_dw1; | |||||
} | |||||
len += elf32_populate_note(NT_PPC_VSX, | |||||
vshr, (char *)dst + len, | |||||
sizeof(vshr), NULL); | |||||
} else | |||||
len += elf32_populate_note(NT_PPC_VSX, NULL, NULL, | |||||
sizeof(vshr), NULL); | |||||
} | |||||
*off = len; | *off = len; | ||||
} | } | ||||
#ifndef __powerpc64__ | #ifndef __powerpc64__ | ||||
/* Process one elf relocation with addend. */ | /* Process one elf relocation with addend. */ | ||||
static int | static int | ||||
elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data, | elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data, | ||||
int type, int local, elf_lookup_fn lookup) | int type, int local, elf_lookup_fn lookup) | ||||
▲ Show 20 Lines • Show All 170 Lines • Show Last 20 Lines |