Commit 6b169ac9 authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

s390/kprobes: add support for compare and branch instructions

The compare and branch instructions (not relative) all need special
handling when kprobed:
- if a branch was taken, the instruction pointer should be left alone
- if a branch was not taken, the instruction pointer must be adjusted

The compare and branch instructions family was introduced with the general
instruction extension facility (z10).
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent bee5c286
...@@ -105,14 +105,31 @@ static int __kprobes get_fixup_type(kprobe_opcode_t *insn) ...@@ -105,14 +105,31 @@ static int __kprobes get_fixup_type(kprobe_opcode_t *insn)
fixup |= FIXUP_RETURN_REGISTER; fixup |= FIXUP_RETURN_REGISTER;
break; break;
case 0xeb: case 0xeb:
if ((insn[2] & 0xff) == 0x44 || /* bxhg */ switch (insn[2] & 0xff) {
(insn[2] & 0xff) == 0x45) /* bxleg */ case 0x44: /* bxhg */
case 0x45: /* bxleg */
fixup = FIXUP_BRANCH_NOT_TAKEN; fixup = FIXUP_BRANCH_NOT_TAKEN;
break;
}
break; break;
case 0xe3: /* bctg */ case 0xe3: /* bctg */
if ((insn[2] & 0xff) == 0x46) if ((insn[2] & 0xff) == 0x46)
fixup = FIXUP_BRANCH_NOT_TAKEN; fixup = FIXUP_BRANCH_NOT_TAKEN;
break; break;
case 0xec:
switch (insn[2] & 0xff) {
case 0xe5: /* clgrb */
case 0xe6: /* cgrb */
case 0xf6: /* crb */
case 0xf7: /* clrb */
case 0xfc: /* cgib */
case 0xfd: /* cglib */
case 0xfe: /* cib */
case 0xff: /* clib */
fixup = FIXUP_BRANCH_NOT_TAKEN;
break;
}
break;
} }
return fixup; return fixup;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment