svn commit: r277167 - head/usr.bin/gcore
Justin Hibbits
jhibbits at FreeBSD.org
Wed Jan 14 07:02:23 UTC 2015
Author: jhibbits
Date: Wed Jan 14 07:02:21 2015
New Revision: 277167
URL: https://svnweb.freebsd.org/changeset/base/277167
Log:
Make use of the new Altivec ptrace support, to save the Altivec registers in
gcore.
MFC after: 2 weeks
Relnotes: yes
Modified:
head/usr.bin/gcore/elfcore.c
Modified: head/usr.bin/gcore/elfcore.c
==============================================================================
--- head/usr.bin/gcore/elfcore.c Wed Jan 14 07:01:21 2015 (r277166)
+++ head/usr.bin/gcore/elfcore.c Wed Jan 14 07:02:21 2015 (r277167)
@@ -105,6 +105,9 @@ static void *elf_note_thrmisc(void *, si
#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,
#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 *s
}
#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)
{
More information about the svn-src-head
mailing list