2 * arch/arm/kernel/kprobes-thumb.c
4 * Copyright (C) 2011 Jon Medhurst <tixy@yxit.co.uk>.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <linux/kernel.h>
12 #include <linux/kprobes.h>
18 * True if current instruction is in an IT block.
20 #define in_it_block(cpsr) ((cpsr & 0x06000c00) != 0x00000000)
23 * Return the condition code to check for the currently executing instruction.
24 * This is in ITSTATE<7:4> which is in CPSR<15:12> but is only valid if
25 * in_it_block returns true.
27 #define current_cond(cpsr) ((cpsr >> 12) & 0xf)
29 static unsigned long __kprobes thumb_check_cc(unsigned long cpsr)
31 if (unlikely(in_it_block(cpsr)))
32 return kprobe_condition_checks[current_cond(cpsr)](cpsr);
36 enum kprobe_insn __kprobes
37 thumb16_kprobe_decode_insn(kprobe_opcode_t insn, struct arch_specific_insn *asi)
39 asi->insn_check_cc = thumb_check_cc;
43 enum kprobe_insn __kprobes
44 thumb32_kprobe_decode_insn(kprobe_opcode_t insn, struct arch_specific_insn *asi)
46 asi->insn_check_cc = thumb_check_cc;