From owner-svn-src-all@freebsd.org Fri Nov 22 04:34:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A3A01AC310; Fri, 22 Nov 2019 04:34:47 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47K3Vv1mFXz4KbB; Fri, 22 Nov 2019 04:34:47 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 212881E537; Fri, 22 Nov 2019 04:34:47 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAM4YlEt060896; Fri, 22 Nov 2019 04:34:47 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAM4YkxD060895; Fri, 22 Nov 2019 04:34:46 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911220434.xAM4YkxD060895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 22 Nov 2019 04:34:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354990 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 354990 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 04:34:47 -0000 Author: jhibbits Date: Fri Nov 22 04:34:46 2019 New Revision: 354990 URL: https://svnweb.freebsd.org/changeset/base/354990 Log: powerpc/ptrace: Give ptrace(2) access to SPE registers when available SPE registers are already exported in core dumps with the VMX note, so use the same interface for live access. Instead of simply guarding out in #ifndef __SPE__ the cpu_feature check, I chose to keep the check and check against PPC_FEATURE_SPE, on the off-chance someone decides to run a SPE kernel on a non-SPE device (which is possible, though highly unlikely, and would be no different from running a MPC85XX kernel in that instance). Modified: head/sys/powerpc/powerpc/ptrace_machdep.c Modified: head/sys/powerpc/powerpc/ptrace_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/ptrace_machdep.c Fri Nov 22 00:22:55 2019 (r354989) +++ head/sys/powerpc/powerpc/ptrace_machdep.c Fri Nov 22 04:34:46 2019 (r354990) @@ -40,6 +40,12 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef __SPE__ +#define PPC_FEATURE_VECTOR PPC_FEATURE_HAS_SPE +#else +#define PPC_FEATURE_VECTOR PPC_FEATURE_HAS_ALTIVEC +#endif + int cpu_ptrace(struct thread *td, int req, void *addr, int data) { @@ -58,7 +64,7 @@ cpu_ptrace(struct thread *td, int req, void *addr, int error = EINVAL; switch (req) { case PT_GETVRREGS: - if (!(cpu_features & PPC_FEATURE_HAS_ALTIVEC)) + if (!(cpu_features & PPC_FEATURE_VECTOR)) break; if (pcb->pcb_flags & PCB_VEC) { @@ -68,7 +74,7 @@ cpu_ptrace(struct thread *td, int req, void *addr, int error = copyout(&vec, addr, sizeof(vec)); break; case PT_SETVRREGS: - if (!(cpu_features & PPC_FEATURE_HAS_ALTIVEC)) + if (!(cpu_features & PPC_FEATURE_VECTOR)) break; error = copyin(addr, &vec, sizeof(vec)); if (error == 0) {