1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * arch/arm/probes/decode-thumb.h
5 * Copyright 2013 Linaro Ltd.
6 * Written by: David A. Long
9 #ifndef _ARM_KERNEL_PROBES_THUMB_H
10 #define _ARM_KERNEL_PROBES_THUMB_H
15 * True if current instruction is in an IT block.
17 #define in_it_block(cpsr) ((cpsr & 0x06000c00) != 0x00000000)
20 * Return the condition code to check for the currently executing instruction.
21 * This is in ITSTATE<7:4> which is in CPSR<15:12> but is only valid if
22 * in_it_block returns true.
24 #define current_cond(cpsr) ((cpsr >> 12) & 0xf)
26 enum probes_t32_action {
27 PROBES_T32_EMULATE_NONE,
28 PROBES_T32_SIMULATE_NOP,
31 PROBES_T32_TABLE_BRANCH,
37 PROBES_T32_ADDWSUBW_PC,
45 PROBES_T32_BRANCH_COND,
50 PROBES_T32_SIGN_EXTEND,
55 PROBES_T32_MUL_ADD_LONG,
56 NUM_PROBES_T32_ACTIONS
59 enum probes_t16_action {
62 PROBES_T16_SIGN_EXTEND,
78 PROBES_T16_BRANCH_COND,
80 NUM_PROBES_T16_ACTIONS
83 extern const union decode_item probes_decode_thumb32_table[];
84 extern const union decode_item probes_decode_thumb16_table[];
86 enum probes_insn __kprobes
87 thumb16_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
88 bool emulate, const union decode_action *actions,
89 const struct decode_checker *checkers[]);
90 enum probes_insn __kprobes
91 thumb32_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
92 bool emulate, const union decode_action *actions,
93 const struct decode_checker *checkers[]);