summaryrefslogtreecommitdiffstats
path: root/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c b/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c
index f076f5d..3b19cc7 100644
--- a/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c
+++ b/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c
@@ -33,6 +33,7 @@
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/ptrace.h>
+#include <sys/rmlock.h>
#include <sys/sysent.h>
#define OP(x) ((x) >> 26)
@@ -302,10 +303,12 @@ static void
fasttrap_return_common(struct reg *rp, uintptr_t pc, pid_t pid,
uintptr_t new_pc)
{
+ struct rm_priotracker tracker;
fasttrap_tracepoint_t *tp;
fasttrap_bucket_t *bucket;
fasttrap_id_t *id;
+ rm_rlock(&fasttrap_tp_lock, &tracker);
bucket = &fasttrap_tpoints.fth_table[FASTTRAP_TPOINTS_INDEX(pid, pc)];
for (tp = bucket->ftb_data; tp != NULL; tp = tp->ftt_next) {
@@ -320,6 +323,7 @@ fasttrap_return_common(struct reg *rp, uintptr_t pc, pid_t pid,
* is not essential to the correct execution of the process.
*/
if (tp == NULL) {
+ rm_runlock(&fasttrap_tp_lock, &tracker);
return;
}
@@ -337,6 +341,7 @@ fasttrap_return_common(struct reg *rp, uintptr_t pc, pid_t pid,
pc - id->fti_probe->ftp_faddr,
rp->fixreg[3], rp->fixreg[4], 0, 0);
}
+ rm_runlock(&fasttrap_tp_lock, &tracker);
}
@@ -365,6 +370,7 @@ fasttrap_branch_taken(int bo, int bi, struct reg *regs)
int
fasttrap_pid_probe(struct reg *rp)
{
+ struct rm_priotracker tracker;
proc_t *p = curproc;
uintptr_t pc = rp->pc;
uintptr_t new_pc = 0;
@@ -395,8 +401,7 @@ fasttrap_pid_probe(struct reg *rp)
curthread->t_dtrace_scrpc = 0;
curthread->t_dtrace_astpc = 0;
-
- PROC_LOCK(p);
+ rm_rlock(&fasttrap_tp_lock, &tracker);
pid = p->p_pid;
bucket = &fasttrap_tpoints.fth_table[FASTTRAP_TPOINTS_INDEX(pid, pc)];
@@ -415,7 +420,7 @@ fasttrap_pid_probe(struct reg *rp)
* fasttrap_ioctl), or somehow we have mislaid this tracepoint.
*/
if (tp == NULL) {
- PROC_UNLOCK(p);
+ rm_runlock(&fasttrap_tp_lock, &tracker);
return (-1);
}
@@ -469,7 +474,7 @@ fasttrap_pid_probe(struct reg *rp)
* tracepoint again later if we need to light up any return probes.
*/
tp_local = *tp;
- PROC_UNLOCK(p);
+ rm_runlock(&fasttrap_tp_lock, &tracker);
tp = &tp_local;
/*
OpenPOWER on IntegriCloud