From owner-svn-src-head@FreeBSD.ORG Wed Jan 14 07:02:23 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0BC71997; Wed, 14 Jan 2015 07:02:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D395F101; Wed, 14 Jan 2015 07:02:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0E72M27009460; Wed, 14 Jan 2015 07:02:22 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0E72M72009459; Wed, 14 Jan 2015 07:02:22 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201501140702.t0E72M72009459@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 14 Jan 2015 07:02:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r277167 - head/usr.bin/gcore X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jan 2015 07:02:23 -0000 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) {