Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * arch/arm/probes/decode-thumb.h
0004  *
0005  * Copyright 2013 Linaro Ltd.
0006  * Written by: David A. Long
0007  */
0008 
0009 #ifndef _ARM_KERNEL_PROBES_THUMB_H
0010 #define  _ARM_KERNEL_PROBES_THUMB_H
0011 
0012 #include "decode.h"
0013 
0014 /*
0015  * True if current instruction is in an IT block.
0016  */
0017 #define in_it_block(cpsr)   ((cpsr & 0x06000c00) != 0x00000000)
0018 
0019 /*
0020  * Return the condition code to check for the currently executing instruction.
0021  * This is in ITSTATE<7:4> which is in CPSR<15:12> but is only valid if
0022  * in_it_block returns true.
0023  */
0024 #define current_cond(cpsr)  ((cpsr >> 12) & 0xf)
0025 
0026 enum probes_t32_action {
0027     PROBES_T32_EMULATE_NONE,
0028     PROBES_T32_SIMULATE_NOP,
0029     PROBES_T32_LDMSTM,
0030     PROBES_T32_LDRDSTRD,
0031     PROBES_T32_TABLE_BRANCH,
0032     PROBES_T32_TST,
0033     PROBES_T32_CMP,
0034     PROBES_T32_MOV,
0035     PROBES_T32_ADDSUB,
0036     PROBES_T32_LOGICAL,
0037     PROBES_T32_ADDWSUBW_PC,
0038     PROBES_T32_ADDWSUBW,
0039     PROBES_T32_MOVW,
0040     PROBES_T32_SAT,
0041     PROBES_T32_BITFIELD,
0042     PROBES_T32_SEV,
0043     PROBES_T32_WFE,
0044     PROBES_T32_MRS,
0045     PROBES_T32_BRANCH_COND,
0046     PROBES_T32_BRANCH,
0047     PROBES_T32_PLDI,
0048     PROBES_T32_LDR_LIT,
0049     PROBES_T32_LDRSTR,
0050     PROBES_T32_SIGN_EXTEND,
0051     PROBES_T32_MEDIA,
0052     PROBES_T32_REVERSE,
0053     PROBES_T32_MUL_ADD,
0054     PROBES_T32_MUL_ADD2,
0055     PROBES_T32_MUL_ADD_LONG,
0056     NUM_PROBES_T32_ACTIONS
0057 };
0058 
0059 enum probes_t16_action {
0060     PROBES_T16_ADD_SP,
0061     PROBES_T16_CBZ,
0062     PROBES_T16_SIGN_EXTEND,
0063     PROBES_T16_PUSH,
0064     PROBES_T16_POP,
0065     PROBES_T16_SEV,
0066     PROBES_T16_WFE,
0067     PROBES_T16_IT,
0068     PROBES_T16_CMP,
0069     PROBES_T16_ADDSUB,
0070     PROBES_T16_LOGICAL,
0071     PROBES_T16_BLX,
0072     PROBES_T16_HIREGOPS,
0073     PROBES_T16_LDR_LIT,
0074     PROBES_T16_LDRHSTRH,
0075     PROBES_T16_LDRSTR,
0076     PROBES_T16_ADR,
0077     PROBES_T16_LDMSTM,
0078     PROBES_T16_BRANCH_COND,
0079     PROBES_T16_BRANCH,
0080     NUM_PROBES_T16_ACTIONS
0081 };
0082 
0083 extern const union decode_item probes_decode_thumb32_table[];
0084 extern const union decode_item probes_decode_thumb16_table[];
0085 
0086 enum probes_insn __kprobes
0087 thumb16_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
0088         bool emulate, const union decode_action *actions,
0089         const struct decode_checker *checkers[]);
0090 enum probes_insn __kprobes
0091 thumb32_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
0092         bool emulate, const union decode_action *actions,
0093         const struct decode_checker *checkers[]);
0094 
0095 #endif