Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src allow pcu_save() and pcu_discard() to be called on other thr...
details: https://anonhg.NetBSD.org/src/rev/b085ac8768bf
branches: trunk
changeset: 822363:b085ac8768bf
user: chs <chs%NetBSD.org@localhost>
date: Thu Mar 16 16:13:19 2017 +0000
description:
allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.
diffstat:
share/man/man9/pcu.9 | 6 +++---
sys/arch/aarch64/include/locore.h | 11 ++++-------
sys/arch/alpha/alpha/compat_13_machdep.c | 6 +++---
sys/arch/alpha/alpha/compat_16_machdep.c | 8 ++++----
sys/arch/alpha/alpha/machdep.c | 8 ++++----
sys/arch/alpha/alpha/process_machdep.c | 8 ++++----
sys/arch/alpha/alpha/trap.c | 8 ++++----
sys/arch/alpha/include/alpha.h | 13 ++++++-------
sys/arch/arm/arm/arm_machdep.c | 6 +++---
sys/arch/arm/arm/process_machdep.c | 8 ++++----
sys/arch/arm/arm32/sys_machdep.c | 8 ++++----
sys/arch/arm/include/locore.h | 8 ++++----
sys/arch/arm/vfp/vfp_init.c | 26 ++++++++++++++------------
sys/arch/mips/include/locore.h | 14 +++++++-------
sys/arch/mips/mips/compat_16_machdep.c | 10 +++++-----
sys/arch/mips/mips/cpu_subr.c | 10 +++++-----
sys/arch/mips/mips/mips_dsp.c | 16 ++++++++--------
sys/arch/mips/mips/mips_fpu.c | 16 ++++++++--------
sys/arch/mips/mips/netbsd32_machdep.c | 7 +++----
sys/arch/mips/mips/process_machdep.c | 8 ++++----
sys/arch/powerpc/booke/spe.c | 8 ++++----
sys/arch/powerpc/include/altivec.h | 10 +++++-----
sys/arch/powerpc/include/fpu.h | 10 +++++-----
sys/arch/powerpc/oea/altivec.c | 13 +++++++------
sys/arch/powerpc/powerpc/fpu.c | 17 ++++++++---------
sys/arch/powerpc/powerpc/process_machdep.c | 26 +++++++-------------------
sys/arch/powerpc/powerpc/trap.c | 18 +++++++++---------
sys/arch/riscv/include/locore.h | 18 +++++++++---------
sys/arch/riscv/riscv/netbsd32_machdep.c | 9 ++++-----
sys/arch/riscv/riscv/process_machdep.c | 23 ++++++++---------------
sys/arch/riscv/riscv/riscv_machdep.c | 8 ++++----
sys/compat/linux/arch/powerpc/linux_machdep.c | 6 +++---
sys/kern/subr_pcu.c | 17 +++++++----------
sys/sys/pcu.h | 8 ++++----
34 files changed, 185 insertions(+), 211 deletions(-)
diffs (truncated from 1386 to 300 lines):
diff -r 11436274ecb8 -r b085ac8768bf share/man/man9/pcu.9
--- a/share/man/man9/pcu.9 Thu Mar 16 13:21:59 2017 +0000
+++ b/share/man/man9/pcu.9 Thu Mar 16 16:13:19 2017 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pcu.9,v 1.10 2014/05/25 14:56:23 rmind Exp $
+.\" $NetBSD: pcu.9,v 1.11 2017/03/16 16:13:19 chs Exp $
.\"
.\" Copyright (c) 2012-2014 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -38,11 +38,11 @@
.Ft void
.Fn pcu_load "const pcu_ops_t *pcu"
.Ft void
-.Fn pcu_save "const pcu_ops_t *pcu"
+.Fn pcu_save "const pcu_ops_t *pcu" "lwp_t *l"
.Ft void
.Fn pcu_save_all "lwp_t *l"
.Ft void
-.Fn pcu_discard "const pcu_ops_t *pcu" "bool valid"
+.Fn pcu_discard "const pcu_ops_t *pcu" "lwp_t *l" "bool valid"
.Ft void
.Fn pcu_discard_all "lwp_t *l"
.Ft bool
diff -r 11436274ecb8 -r b085ac8768bf sys/arch/aarch64/include/locore.h
--- a/sys/arch/aarch64/include/locore.h Thu Mar 16 13:21:59 2017 +0000
+++ b/sys/arch/aarch64/include/locore.h Thu Mar 16 16:13:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.h,v 1.1 2014/08/10 05:47:38 matt Exp $ */
+/* $NetBSD: locore.h,v 1.2 2017/03/16 16:13:19 chs Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -69,22 +69,19 @@
static inline bool
fpu_used_p(lwp_t *l)
{
- KASSERT(l == curlwp);
- return pcu_valid_p(&pcu_fpu_ops);
+ return pcu_valid_p(&pcu_fpu_ops, l);
}
static inline void
fpu_discard(lwp_t *l, bool usesw)
{
- KASSERT(l == curlwp);
- pcu_discard(&pcu_fpu_ops, usesw);
+ pcu_discard(&pcu_fpu_ops, l, usesw);
}
static inline void
fpu_save(lwp_t *l)
{
- KASSERT(l == curlwp);
- pcu_save(&pcu_fpu_ops);
+ pcu_save(&pcu_fpu_ops, l);
}
static inline void cpsie(register_t psw) __attribute__((__unused__));
diff -r 11436274ecb8 -r b085ac8768bf sys/arch/alpha/alpha/compat_13_machdep.c
--- a/sys/arch/alpha/alpha/compat_13_machdep.c Thu Mar 16 13:21:59 2017 +0000
+++ b/sys/arch/alpha/alpha/compat_13_machdep.c Thu Mar 16 16:13:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_13_machdep.c,v 1.21 2014/05/16 19:18:21 matt Exp $ */
+/* $NetBSD: compat_13_machdep.c,v 1.22 2017/03/16 16:13:20 chs Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.21 2014/05/16 19:18:21 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.22 2017/03/16 16:13:20 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -94,7 +94,7 @@
/* XXX ksc.sc_ownedfp ? */
pcb = lwp_getpcb(l);
- fpu_discard(true);
+ fpu_discard(l, true);
memcpy(&pcb->pcb_fp, (struct fpreg *)ksc.sc_fpregs,
sizeof(struct fpreg));
/* XXX ksc.sc_fp_control ? */
diff -r 11436274ecb8 -r b085ac8768bf sys/arch/alpha/alpha/compat_16_machdep.c
--- a/sys/arch/alpha/alpha/compat_16_machdep.c Thu Mar 16 13:21:59 2017 +0000
+++ b/sys/arch/alpha/alpha/compat_16_machdep.c Thu Mar 16 16:13:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_16_machdep.c,v 1.20 2016/03/19 20:57:48 mrg Exp $ */
+/* $NetBSD: compat_16_machdep.c,v 1.21 2017/03/16 16:13:20 chs Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -86,7 +86,7 @@
#include <machine/cpu.h>
#include <machine/reg.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.20 2016/03/19 20:57:48 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.21 2017/03/16 16:13:20 chs Exp $");
#ifdef DEBUG
@@ -132,7 +132,7 @@
frame.sf_sc.sc_regs[R_SP] = alpha_pal_rdusp();
/* save the floating-point state, if necessary, then copy it. */
- fpu_save();
+ fpu_save(l);
frame.sf_sc.sc_ownedfp = fpu_valid_p(l);
memcpy((struct fpreg *)frame.sf_sc.sc_fpregs, &pcb->pcb_fp,
sizeof(struct fpreg));
@@ -281,7 +281,7 @@
alpha_pal_wrusp(ksc.sc_regs[R_SP]);
pcb = lwp_getpcb(l);
- fpu_discard(true);
+ fpu_discard(l, true);
memcpy(&pcb->pcb_fp, (struct fpreg *)ksc.sc_fpregs,
sizeof(struct fpreg));
pcb->pcb_fp.fpr_cr = ksc.sc_fpcr;
diff -r 11436274ecb8 -r b085ac8768bf sys/arch/alpha/alpha/machdep.c
--- a/sys/arch/alpha/alpha/machdep.c Thu Mar 16 13:21:59 2017 +0000
+++ b/sys/arch/alpha/alpha/machdep.c Thu Mar 16 16:13:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.349 2016/12/23 07:15:27 cherry Exp $ */
+/* $NetBSD: machdep.c,v 1.350 2017/03/16 16:13:20 chs Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.349 2016/12/23 07:15:27 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.350 2017/03/16 16:13:20 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1796,7 +1796,7 @@
/* Save floating point register context, if any, and copy it. */
if (fpu_valid_p(l)) {
- fpu_save();
+ fpu_save(l);
(void)memcpy(&mcp->__fpregs, &pcb->pcb_fp,
sizeof (mcp->__fpregs));
mcp->__fpregs.__fp_fpcr = alpha_read_fp_c(l);
@@ -1844,7 +1844,7 @@
/* Restore floating point register context, if any. */
if (flags & _UC_FPU) {
/* If we have an FP register context, get rid of it. */
- fpu_discard(true);
+ fpu_discard(l, true);
(void)memcpy(&pcb->pcb_fp, &mcp->__fpregs,
sizeof (pcb->pcb_fp));
l->l_md.md_flags = mcp->__fpregs.__fp_fpcr & MDLWP_FP_C;
diff -r 11436274ecb8 -r b085ac8768bf sys/arch/alpha/alpha/process_machdep.c
--- a/sys/arch/alpha/alpha/process_machdep.c Thu Mar 16 13:21:59 2017 +0000
+++ b/sys/arch/alpha/alpha/process_machdep.c Thu Mar 16 16:13:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: process_machdep.c,v 1.29 2014/05/16 19:18:21 matt Exp $ */
+/* $NetBSD: process_machdep.c,v 1.30 2017/03/16 16:13:20 chs Exp $ */
/*
* Copyright (c) 1994 Christopher G. Demetriou
@@ -54,7 +54,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.29 2014/05/16 19:18:21 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.30 2017/03/16 16:13:20 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -116,7 +116,7 @@
{
struct pcb *pcb = lwp_getpcb(l);
- fpu_save();
+ fpu_save(l);
memcpy(regs, &pcb->pcb_fp, sizeof(struct fpreg));
return (0);
@@ -127,7 +127,7 @@
{
struct pcb *pcb = lwp_getpcb(l);
- fpu_discard(true);
+ fpu_discard(l, true);
memcpy(&pcb->pcb_fp, regs, sizeof(struct fpreg));
return (0);
diff -r 11436274ecb8 -r b085ac8768bf sys/arch/alpha/alpha/trap.c
--- a/sys/arch/alpha/alpha/trap.c Thu Mar 16 13:21:59 2017 +0000
+++ b/sys/arch/alpha/alpha/trap.c Thu Mar 16 16:13:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.132 2015/03/02 11:07:16 martin Exp $ */
+/* $NetBSD: trap.c,v 1.133 2017/03/16 16:13:20 chs Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -93,7 +93,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.132 2015/03/02 11:07:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.133 2017/03/16 16:13:20 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -641,13 +641,13 @@
#define unaligned_load_floating(storage, mod) do { \
struct pcb * const pcb = lwp_getpcb(l); \
- fpu_save(); \
+ fpu_save(l); \
unaligned_load(storage, frp, mod) \
} while (/*CONSTCOND*/0)
#define unaligned_store_floating(storage, mod) do { \
struct pcb * const pcb = lwp_getpcb(l); \
- fpu_save(); \
+ fpu_save(l); \
unaligned_store(storage, frp, mod) \
} while (/*CONSTCOND*/0)
diff -r 11436274ecb8 -r b085ac8768bf sys/arch/alpha/include/alpha.h
--- a/sys/arch/alpha/include/alpha.h Thu Mar 16 13:21:59 2017 +0000
+++ b/sys/arch/alpha/include/alpha.h Thu Mar 16 16:13:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: alpha.h,v 1.34 2014/05/16 19:18:21 matt Exp $ */
+/* $NetBSD: alpha.h,v 1.35 2017/03/16 16:13:20 chs Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -116,8 +116,7 @@
static inline bool
fpu_valid_p(struct lwp *l)
{
- KASSERT(l == curlwp);
- return pcu_valid_p(&fpu_ops);
+ return pcu_valid_p(&fpu_ops, l);
}
static inline void
@@ -127,15 +126,15 @@
}
static inline void
-fpu_save(void)
+fpu_save(lwp_t *l)
{
- pcu_save(&fpu_ops);
+ pcu_save(&fpu_ops, l);
}
static inline void
-fpu_discard(bool valid_p)
+fpu_discard(lwp_t *l, bool valid_p)
{
- pcu_discard(&fpu_ops, valid_p);
+ pcu_discard(&fpu_ops, l, valid_p);
}
void alpha_patch(bool);
diff -r 11436274ecb8 -r b085ac8768bf sys/arch/arm/arm/arm_machdep.c
--- a/sys/arch/arm/arm/arm_machdep.c Thu Mar 16 13:21:59 2017 +0000
+++ b/sys/arch/arm/arm/arm_machdep.c Thu Mar 16 16:13:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm_machdep.c,v 1.49 2015/05/02 16:20:41 skrll Exp $ */
+/* $NetBSD: arm_machdep.c,v 1.50 2017/03/16 16:13:20 chs Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
#include <sys/param.h>
-__KERNEL_RCSID(0, "$NetBSD: arm_machdep.c,v 1.49 2015/05/02 16:20:41 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm_machdep.c,v 1.50 2017/03/16 16:13:20 chs Exp $");
#include <sys/exec.h>
#include <sys/proc.h>
@@ -201,7 +201,7 @@
l->l_md.md_flags |= MDLWP_NOALIGNFLT;
#endif
#ifdef FPU_VFP
- vfp_discardcontext(false);
+ vfp_discardcontext(l, false);
#endif
}
diff -r 11436274ecb8 -r b085ac8768bf sys/arch/arm/arm/process_machdep.c
--- a/sys/arch/arm/arm/process_machdep.c Thu Mar 16 13:21:59 2017 +0000
+++ b/sys/arch/arm/arm/process_machdep.c Thu Mar 16 16:13:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: process_machdep.c,v 1.31 2017/02/21 07:40:28 skrll Exp $ */
+/* $NetBSD: process_machdep.c,v 1.32 2017/03/16 16:13:20 chs Exp $ */
Home |
Main Index |
Thread Index |
Old Index