The branch main has been updated by pkubaj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=aad2ea36592611a11bdd690b0c8697b4093755f8

commit aad2ea36592611a11bdd690b0c8697b4093755f8
Author:     Piotr Kubaj <[email protected]>
AuthorDate: 2026-10-05 11:57:24 +0000
Commit:     Piotr Kubaj <[email protected]>
CommitDate: 2026-12-03 14:49:57 +0000

    dtrace/powerpc: decode blr and bctr in the pid provider
    
    OPX() shifted the instruction by two bits instead of one, so the
    extended opcode never matched and blr and bctr weren't recognised.
    They were treated like any other instruction, which means a single
    step that powerpc doesn't have. A return probe on a function that ends
    in blr panics an INVARIANTS kernel, and without INVARIANTS the traced
    process spins on the tracepoint.
    
    Fix the shift. Two more things were hidden behind it and have to be
    fixed with it: bclr was typed as a bctr, so it would have returned
    through CTR, and OP_RB() had the wrong mask, so some real or
    instructions would have been taken for no-ops.
    
    Reviewed by:    jhibbits
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D62360
---
 sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c | 6 +++---
 1 file changed, 3 insertions(+), 3 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 8f370ba6a186..269541d15ed9 100644
--- a/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c
+++ b/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c
@@ -37,12 +37,12 @@
 #include <sys/sysent.h>
 
 #define OP(x)  ((x) >> 26)
-#define OPX(x) (((x) >> 2) & 0x3FF)
+#define OPX(x) (((x) >> 1) & 0x3FF)
 #define OP_BO(x) (((x) & 0x03E00000) >> 21)
 #define OP_BI(x) (((x) & 0x001F0000) >> 16)
 #define OP_RS(x) (((x) & 0x03E00000) >> 21)
 #define OP_RA(x) (((x) & 0x001F0000) >> 16)
-#define OP_RB(x) (((x) & 0x0000F100) >> 11)
+#define OP_RB(x) (((x) & 0x0000F800) >> 11)
 
 int
 fasttrap_tracepoint_install(proc_t *p, fasttrap_tracepoint_t *tp)
@@ -154,7 +154,7 @@ fasttrap_tracepoint_init(proc_t *p, fasttrap_tracepoint_t 
*tp, uintptr_t pc,
                        tp->ftt_bi = OP_BI(instr);
                        break;
                case 16:        /* bclr */
-                       tp->ftt_type = FASTTRAP_T_BCTR;
+                       tp->ftt_type = FASTTRAP_T_BLR;
                        tp->ftt_bo = OP_BO(instr);
                        tp->ftt_bi = OP_BI(instr);
                        break;

Reply via email to