• Maneesh Soni's avatar
    MIPS Kprobes: Support branch instructions probing · 6457a396
    Maneesh Soni authored
    This patch provides support for kprobes on branch instructions. The branch
    instruction at the probed address is actually emulated and not executed
    out-of-line like other normal instructions. Instead the delay-slot instruction
    is copied and single stepped out of line.
    
    At the time of probe hit, the original branch instruction is evaluated
    and the target cp0_epc is computed similar to compute_retrun_epc(). It
    is also checked if the delay slot instruction can be skipped, which is
    true if there is a NOP in delay slot or branch is taken in case of
    branch likely instructions. Once the delay slot instruction is single
    stepped the normal execution resume with the cp0_epc updated the earlier
    computed cp0_epc as per the branch instructions.
    Signed-off-by: default avatarManeesh Soni <manesoni@cisco.com>
    Signed-off-by: default avatarVictor Kamensky <kamensky@cisco.com>
    Cc: David Daney <david.daney@cavium.com>
    Cc: ananth@in.ibm.com
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/2914/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
    6457a396
kprobes.c 16.9 KB