Changeset View
Changeset View
Standalone View
Standalone View
sys/powerpc/powerpc/elf64_machdep.c
Show First 20 Lines • Show All 42 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/md_var.h> | #include <machine/md_var.h> | ||||
static void exec_setregs_funcdesc(struct thread *td, struct image_params *imgp, | static void exec_setregs_funcdesc(struct thread *td, struct image_params *imgp, | ||||
u_long stack); | u_long stack); | ||||
struct sysentvec elf64_freebsd_sysvec_v1 = { | struct sysentvec elf64_freebsd_sysvec_v1 = { | ||||
.sv_size = SYS_MAXSYSCALL, | .sv_size = SYS_MAXSYSCALL, | ||||
▲ Show 20 Lines • Show All 170 Lines • ▼ Show 20 Lines | exec_setregs_funcdesc(struct thread *td, struct image_params *imgp, | ||||
tf->fixreg[11] = entry_desc[2] + imgp->reloc_base; | tf->fixreg[11] = entry_desc[2] + imgp->reloc_base; | ||||
} | } | ||||
void | void | ||||
elf64_dump_thread(struct thread *td, void *dst, size_t *off) | elf64_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 += elf64_populate_note(NT_PPC_VMX, | len += elf64_populate_note(NT_PPC_VMX, | ||||
&pcb->pcb_vec, dst, | &pcb->pcb_vec, (char *)dst + len, | ||||
jhibbits: Is this change needed? 'len' is already 0 at this point. I guess if we were to add something… | |||||
lffpires_ruabrasil.orgAuthorUnsubmitted Not Done Inline ActionsIt's not needed. I did it because I thought making all the 'if' blocks (VMX / VSX) here the same would make the code less susceptible to errors. When adding new ones, people could just copy from either of them, change their order, and so on, without breaking anything. I guess it's the same thinking that led to using "len +=" instead of "len =" at the beginning of the line. lffpires_ruabrasil.org: It's not needed. I did it because I thought making all the 'if' blocks (VMX / VSX) here the… | |||||
sizeof(pcb->pcb_vec), NULL); | sizeof(pcb->pcb_vec), NULL); | ||||
} else | } else | ||||
len += elf64_populate_note(NT_PPC_VMX, NULL, NULL, | len += elf64_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 += elf64_populate_note(NT_PPC_VSX, | |||||
vshr, (char *)dst + len, | |||||
sizeof(vshr), NULL); | |||||
} else | |||||
len += elf64_populate_note(NT_PPC_VSX, NULL, NULL, | |||||
sizeof(vshr), NULL); | |||||
} | |||||
*off = len; | *off = len; | ||||
} | } | ||||
/* 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 122 Lines • Show Last 20 Lines |
Is this change needed? 'len' is already 0 at this point. I guess if we were to add something before VMX this would be necessary.