diff options
author | jhibbits <jhibbits@FreeBSD.org> | 2015-01-14 07:02:21 +0000 |
---|---|---|
committer | jhibbits <jhibbits@FreeBSD.org> | 2015-01-14 07:02:21 +0000 |
commit | 6354209c5f275ac76f0f7ba57cc92ded7773a5fa (patch) | |
tree | 99fd356de8470dffb6c0fbf98baee7c3602ade2f /usr.bin/gcore | |
parent | 61bfd7e1b2c8d9ef553143272ef062f505db7a9b (diff) | |
download | FreeBSD-src-6354209c5f275ac76f0f7ba57cc92ded7773a5fa.zip FreeBSD-src-6354209c5f275ac76f0f7ba57cc92ded7773a5fa.tar.gz |
Make use of the new Altivec ptrace support, to save the Altivec registers in
gcore.
MFC after: 2 weeks
Relnotes: yes
Diffstat (limited to 'usr.bin/gcore')
-rw-r--r-- | usr.bin/gcore/elfcore.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/usr.bin/gcore/elfcore.c b/usr.bin/gcore/elfcore.c index fb3bf50..d487b21 100644 --- a/usr.bin/gcore/elfcore.c +++ b/usr.bin/gcore/elfcore.c @@ -105,6 +105,9 @@ static void *elf_note_thrmisc(void *, size_t *); #if defined(__i386__) || defined(__amd64__) static void *elf_note_x86_xstate(void *, size_t *); #endif +#if defined(__powerpc__) +static void *elf_note_powerpc_vmx(void *, size_t *); +#endif static void *elf_note_procstat_auxv(void *, size_t *); static void *elf_note_procstat_files(void *, size_t *); static void *elf_note_procstat_groups(void *, size_t *); @@ -348,6 +351,9 @@ elf_putnotes(pid_t pid, struct sbuf *sb, size_t *sizep) #if defined(__i386__) || defined(__amd64__) elf_putnote(NT_X86_XSTATE, elf_note_x86_xstate, tids + i, sb); #endif +#if defined(__powerpc__) + elf_putnote(NT_PPC_VMX, elf_note_powerpc_vmx, tids + i, sb); +#endif } #ifndef ELFCORE_COMPAT_32 @@ -650,6 +656,32 @@ elf_note_x86_xstate(void *arg, size_t *sizep) } #endif +#if defined(__powerpc__) +static void * +elf_note_powerpc_vmx(void *arg, size_t *sizep) +{ + lwpid_t tid; + struct vmxreg *vmx; + static bool has_vmx = true; + struct vmxreg info; + + tid = *(lwpid_t *)arg; + if (has_vmx) { + if (ptrace(PT_GETVRREGS, tid, (void *)&info, + sizeof(info)) != 0) + has_vmx = false; + } + if (!has_vmx) { + *sizep = 0; + return (NULL); + } + vmx = calloc(1, sizeof(*vmx)); + memcpy(vmx, &info, sizeof(*vmx)); + *sizep = sizeof(*vmx); + return (vmx); +} +#endif + static void * procstat_sysctl(void *arg, int what, size_t structsz, size_t *sizep) { |