[PATCH 2/3] s390/probes: Add missing fixup for bctgr and bic

From: Heiko Carstens

Date: Mon Oct 12 2026 - 04:39:50 EST


For the bctgr and bic instructions the probes fixup is missing.
For both instructions the instruction address must only be fixed up
if the branch is not taken. If the branch is taken the instruction
address is already correct.

Return FIXUP_BRANCH_NOT_TAKEN instead of the default FIXUP_PSW_NORMAL
to reflect that.

Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
---
arch/s390/lib/probes.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/s390/lib/probes.c b/arch/s390/lib/probes.c
index 049300b68ddd..3e7654223b05 100644
--- a/arch/s390/lib/probes.c
+++ b/arch/s390/lib/probes.c
@@ -77,6 +77,10 @@ int probe_get_fixup_type(u16 *insn)
if ((insn[0] & 0xff) == 0xb2)
fixup = FIXUP_NOT_REQUIRED;
break;
+ case 0xb9: /* bctgr */
+ if ((insn[0] & 0xff) == 0x46)
+ fixup = FIXUP_BRANCH_NOT_TAKEN;
+ break;
case 0xa7: /* bras */
if ((insn[0] & 0x0f) == 0x05)
fixup |= FIXUP_RETURN_REGISTER;
@@ -85,6 +89,14 @@ int probe_get_fixup_type(u16 *insn)
if ((insn[0] & 0x0f) == 0x05) /* brasl */
fixup |= FIXUP_RETURN_REGISTER;
break;
+ case 0xe3:
+ switch (insn[2] & 0xff) {
+ case 0x46: /* bctg */
+ case 0x47: /* bic */
+ fixup = FIXUP_BRANCH_NOT_TAKEN;
+ break;
+ }
+ break;
case 0xeb:
switch (insn[2] & 0xff) {
case 0x44: /* bxhg */
@@ -93,10 +105,6 @@ int probe_get_fixup_type(u16 *insn)
break;
}
break;
- case 0xe3: /* bctg */
- if ((insn[2] & 0xff) == 0x46)
- fixup = FIXUP_BRANCH_NOT_TAKEN;
- break;
case 0xec:
switch (insn[2] & 0xff) {
case 0xe4: /* cgrb */
--
2.53.0