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 <machine/md_var.h> #include <machine/pcb.h> +#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) { _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"