diff options
author | Justin Hibbits <jhibbits@FreeBSD.org> | 2018-06-02 20:28:58 +0000 |
---|---|---|
committer | Justin Hibbits <jhibbits@FreeBSD.org> | 2018-06-02 20:28:58 +0000 |
commit | 5167f178ab866f4ccba4edac61260df4150f7560 (patch) | |
tree | 62c026e529a801afb659d5b398ad6363e5aabdef /usr.bin/gcore | |
parent | 15825d5b78305372867454dd15f34b4f0dc86286 (diff) | |
download | src-test2-5167f178ab866f4ccba4edac61260df4150f7560.tar.gz src-test2-5167f178ab866f4ccba4edac61260df4150f7560.zip |
Notes
Diffstat (limited to 'usr.bin/gcore')
-rw-r--r-- | usr.bin/gcore/elfcore.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/usr.bin/gcore/elfcore.c b/usr.bin/gcore/elfcore.c index 706d4b5b23a3..087fcb5f7b46 100644 --- a/usr.bin/gcore/elfcore.c +++ b/usr.bin/gcore/elfcore.c @@ -119,6 +119,7 @@ static void *elf_note_x86_xstate(void *, size_t *); #endif #if defined(__powerpc__) static void *elf_note_powerpc_vmx(void *, size_t *); +static void *elf_note_powerpc_vsx(void *, size_t *); #endif static void *elf_note_procstat_auxv(void *, size_t *); static void *elf_note_procstat_files(void *, size_t *); @@ -381,6 +382,7 @@ elf_putnotes(pid_t pid, struct sbuf *sb, size_t *sizep) #endif #if defined(__powerpc__) elf_putnote(NT_PPC_VMX, elf_note_powerpc_vmx, tids + i, sb); + elf_putnote(NT_PPC_VSX, elf_note_powerpc_vsx, tids + i, sb); #endif } @@ -803,6 +805,30 @@ elf_note_powerpc_vmx(void *arg, size_t *sizep) *sizep = sizeof(*vmx); return (vmx); } + +static void * +elf_note_powerpc_vsx(void *arg, size_t *sizep) +{ + lwpid_t tid; + char *vshr_data; + static bool has_vsx = true; + uint64_t vshr[32]; + + tid = *(lwpid_t *)arg; + if (has_vsx) { + if (ptrace(PT_GETVSRREGS, tid, (void *)vshr, + sizeof(vshr)) != 0) + has_vsx = false; + } + if (!has_vsx) { + *sizep = 0; + return (NULL); + } + vshr_data = calloc(1, sizeof(vshr)); + memcpy(vshr_data, vshr, sizeof(vshr)); + *sizep = sizeof(vshr); + return (vshr_data); +} #endif static void * |