From 5bab62343899b8c1aeaa4902a179423ef8915ec0 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Mon, 11 Dec 2017 19:21:39 +0000 Subject: Pass the trap frame to fasttrap hooks. The DTrace fasttrap entry points expect a struct reg containing the register values of the calling thread. Perform the conversion in fasttrap rather than in the trap handler: this reduces the number of ifdefs and avoids wasting stack space for traps that don't involve DTrace. MFC after: 2 weeks --- .../opensolaris/uts/powerpc/dtrace/fasttrap_isa.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'sys/cddl/contrib/opensolaris/uts/powerpc') 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 b0fc5816c5e3..a2732cb5d56f 100644 --- a/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c +++ b/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c @@ -328,8 +328,9 @@ fasttrap_branch_taken(int bo, int bi, struct reg *regs) int -fasttrap_pid_probe(struct reg *rp) +fasttrap_pid_probe(struct trapframe *frame) { + struct reg reg, *rp; struct rm_priotracker tracker; proc_t *p = curproc; uintptr_t pc = rp->pc; @@ -340,6 +341,9 @@ fasttrap_pid_probe(struct reg *rp) dtrace_icookie_t cookie; uint_t is_enabled = 0; + fill_regs(curthread, ®); + rp = ® + /* * It's possible that a user (in a veritable orgy of bad planning) * could redirect this thread's flow of control before it reached the @@ -515,8 +519,9 @@ done: } int -fasttrap_return_probe(struct reg *rp) +fasttrap_return_probe(struct trapframe *tf) { + struct reg reg, *rp; proc_t *p = curproc; uintptr_t pc = curthread->t_dtrace_pc; uintptr_t npc = curthread->t_dtrace_npc; @@ -526,12 +531,13 @@ fasttrap_return_probe(struct reg *rp) curthread->t_dtrace_scrpc = 0; curthread->t_dtrace_astpc = 0; + fill_regs(curthread, ®); + rp = ® + /* * We set rp->pc to the address of the traced instruction so * that it appears to dtrace_probe() that we're on the original - * instruction, and so that the user can't easily detect our - * complex web of lies. dtrace_return_probe() (our caller) - * will correctly set %pc after we return. + * instruction. */ rp->pc = pc; @@ -539,4 +545,3 @@ fasttrap_return_probe(struct reg *rp) return (0); } - -- cgit v1.2.3