162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * arch/arm/probes/decode.h 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2011 Jon Medhurst <tixy@yxit.co.uk>. 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Some contents moved here from arch/arm/include/asm/kprobes.h which is 862306a36Sopenharmony_ci * Copyright (C) 2006, 2007 Motorola Inc. 962306a36Sopenharmony_ci */ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#ifndef _ARM_KERNEL_PROBES_H 1262306a36Sopenharmony_ci#define _ARM_KERNEL_PROBES_H 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#include <linux/types.h> 1562306a36Sopenharmony_ci#include <linux/stddef.h> 1662306a36Sopenharmony_ci#include <asm/probes.h> 1762306a36Sopenharmony_ci#include <asm/ptrace.h> 1862306a36Sopenharmony_ci#include <asm/kprobes.h> 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_civoid __init arm_probes_decode_init(void); 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ciextern probes_check_cc * const probes_condition_checks[16]; 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci#if __LINUX_ARM_ARCH__ >= 7 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci/* str_pc_offset is architecturally defined from ARMv7 onwards */ 2762306a36Sopenharmony_ci#define str_pc_offset 8 2862306a36Sopenharmony_ci#define find_str_pc_offset() 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci#else /* __LINUX_ARM_ARCH__ < 7 */ 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci/* We need a run-time check to determine str_pc_offset */ 3362306a36Sopenharmony_ciextern int str_pc_offset; 3462306a36Sopenharmony_civoid __init find_str_pc_offset(void); 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci#endif 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_cistatic inline void __kprobes bx_write_pc(long pcv, struct pt_regs *regs) 4062306a36Sopenharmony_ci{ 4162306a36Sopenharmony_ci long cpsr = regs->ARM_cpsr; 4262306a36Sopenharmony_ci if (pcv & 0x1) { 4362306a36Sopenharmony_ci cpsr |= PSR_T_BIT; 4462306a36Sopenharmony_ci pcv &= ~0x1; 4562306a36Sopenharmony_ci } else { 4662306a36Sopenharmony_ci cpsr &= ~PSR_T_BIT; 4762306a36Sopenharmony_ci pcv &= ~0x2; /* Avoid UNPREDICTABLE address allignment */ 4862306a36Sopenharmony_ci } 4962306a36Sopenharmony_ci regs->ARM_cpsr = cpsr; 5062306a36Sopenharmony_ci regs->ARM_pc = pcv; 5162306a36Sopenharmony_ci} 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci#if __LINUX_ARM_ARCH__ >= 6 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci/* Kernels built for >= ARMv6 should never run on <= ARMv5 hardware, so... */ 5762306a36Sopenharmony_ci#define load_write_pc_interworks true 5862306a36Sopenharmony_ci#define test_load_write_pc_interworking() 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci#else /* __LINUX_ARM_ARCH__ < 6 */ 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci/* We need run-time testing to determine if load_write_pc() should interwork. */ 6362306a36Sopenharmony_ciextern bool load_write_pc_interworks; 6462306a36Sopenharmony_civoid __init test_load_write_pc_interworking(void); 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci#endif 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_cistatic inline void __kprobes load_write_pc(long pcv, struct pt_regs *regs) 6962306a36Sopenharmony_ci{ 7062306a36Sopenharmony_ci if (load_write_pc_interworks) 7162306a36Sopenharmony_ci bx_write_pc(pcv, regs); 7262306a36Sopenharmony_ci else 7362306a36Sopenharmony_ci regs->ARM_pc = pcv; 7462306a36Sopenharmony_ci} 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci#if __LINUX_ARM_ARCH__ >= 7 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci#define alu_write_pc_interworks true 8062306a36Sopenharmony_ci#define test_alu_write_pc_interworking() 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci#elif __LINUX_ARM_ARCH__ <= 5 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci/* Kernels built for <= ARMv5 should never run on >= ARMv6 hardware, so... */ 8562306a36Sopenharmony_ci#define alu_write_pc_interworks false 8662306a36Sopenharmony_ci#define test_alu_write_pc_interworking() 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci#else /* __LINUX_ARM_ARCH__ == 6 */ 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_ci/* We could be an ARMv6 binary on ARMv7 hardware so we need a run-time check. */ 9162306a36Sopenharmony_ciextern bool alu_write_pc_interworks; 9262306a36Sopenharmony_civoid __init test_alu_write_pc_interworking(void); 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ci#endif /* __LINUX_ARM_ARCH__ == 6 */ 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_cistatic inline void __kprobes alu_write_pc(long pcv, struct pt_regs *regs) 9762306a36Sopenharmony_ci{ 9862306a36Sopenharmony_ci if (alu_write_pc_interworks) 9962306a36Sopenharmony_ci bx_write_pc(pcv, regs); 10062306a36Sopenharmony_ci else 10162306a36Sopenharmony_ci regs->ARM_pc = pcv; 10262306a36Sopenharmony_ci} 10362306a36Sopenharmony_ci 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ci/* 10662306a36Sopenharmony_ci * Test if load/store instructions writeback the address register. 10762306a36Sopenharmony_ci * if P (bit 24) == 0 or W (bit 21) == 1 10862306a36Sopenharmony_ci */ 10962306a36Sopenharmony_ci#define is_writeback(insn) ((insn ^ 0x01000000) & 0x01200000) 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci/* 11262306a36Sopenharmony_ci * The following definitions and macros are used to build instruction 11362306a36Sopenharmony_ci * decoding tables for use by probes_decode_insn. 11462306a36Sopenharmony_ci * 11562306a36Sopenharmony_ci * These tables are a concatenation of entries each of which consist of one of 11662306a36Sopenharmony_ci * the decode_* structs. All of the fields in every type of decode structure 11762306a36Sopenharmony_ci * are of the union type decode_item, therefore the entire decode table can be 11862306a36Sopenharmony_ci * viewed as an array of these and declared like: 11962306a36Sopenharmony_ci * 12062306a36Sopenharmony_ci * static const union decode_item table_name[] = {}; 12162306a36Sopenharmony_ci * 12262306a36Sopenharmony_ci * In order to construct each entry in the table, macros are used to 12362306a36Sopenharmony_ci * initialise a number of sequential decode_item values in a layout which 12462306a36Sopenharmony_ci * matches the relevant struct. E.g. DECODE_SIMULATE initialise a struct 12562306a36Sopenharmony_ci * decode_simulate by initialising four decode_item objects like this... 12662306a36Sopenharmony_ci * 12762306a36Sopenharmony_ci * {.bits = _type}, 12862306a36Sopenharmony_ci * {.bits = _mask}, 12962306a36Sopenharmony_ci * {.bits = _value}, 13062306a36Sopenharmony_ci * {.action = _handler}, 13162306a36Sopenharmony_ci * 13262306a36Sopenharmony_ci * Initialising a specified member of the union means that the compiler 13362306a36Sopenharmony_ci * will produce a warning if the argument is of an incorrect type. 13462306a36Sopenharmony_ci * 13562306a36Sopenharmony_ci * Below is a list of each of the macros used to initialise entries and a 13662306a36Sopenharmony_ci * description of the action performed when that entry is matched to an 13762306a36Sopenharmony_ci * instruction. A match is found when (instruction & mask) == value. 13862306a36Sopenharmony_ci * 13962306a36Sopenharmony_ci * DECODE_TABLE(mask, value, table) 14062306a36Sopenharmony_ci * Instruction decoding jumps to parsing the new sub-table 'table'. 14162306a36Sopenharmony_ci * 14262306a36Sopenharmony_ci * DECODE_CUSTOM(mask, value, decoder) 14362306a36Sopenharmony_ci * The value of 'decoder' is used as an index into the array of 14462306a36Sopenharmony_ci * action functions, and the retrieved decoder function is invoked 14562306a36Sopenharmony_ci * to complete decoding of the instruction. 14662306a36Sopenharmony_ci * 14762306a36Sopenharmony_ci * DECODE_SIMULATE(mask, value, handler) 14862306a36Sopenharmony_ci * The probes instruction handler is set to the value found by 14962306a36Sopenharmony_ci * indexing into the action array using the value of 'handler'. This 15062306a36Sopenharmony_ci * will be used to simulate the instruction when the probe is hit. 15162306a36Sopenharmony_ci * Decoding returns with INSN_GOOD_NO_SLOT. 15262306a36Sopenharmony_ci * 15362306a36Sopenharmony_ci * DECODE_EMULATE(mask, value, handler) 15462306a36Sopenharmony_ci * The probes instruction handler is set to the value found by 15562306a36Sopenharmony_ci * indexing into the action array using the value of 'handler'. This 15662306a36Sopenharmony_ci * will be used to emulate the instruction when the probe is hit. The 15762306a36Sopenharmony_ci * modified instruction (see below) is placed in the probes instruction 15862306a36Sopenharmony_ci * slot so it may be called by the emulation code. Decoding returns 15962306a36Sopenharmony_ci * with INSN_GOOD. 16062306a36Sopenharmony_ci * 16162306a36Sopenharmony_ci * DECODE_REJECT(mask, value) 16262306a36Sopenharmony_ci * Instruction decoding fails with INSN_REJECTED 16362306a36Sopenharmony_ci * 16462306a36Sopenharmony_ci * DECODE_OR(mask, value) 16562306a36Sopenharmony_ci * This allows the mask/value test of multiple table entries to be 16662306a36Sopenharmony_ci * logically ORed. Once an 'or' entry is matched the decoding action to 16762306a36Sopenharmony_ci * be performed is that of the next entry which isn't an 'or'. E.g. 16862306a36Sopenharmony_ci * 16962306a36Sopenharmony_ci * DECODE_OR (mask1, value1) 17062306a36Sopenharmony_ci * DECODE_OR (mask2, value2) 17162306a36Sopenharmony_ci * DECODE_SIMULATE (mask3, value3, simulation_handler) 17262306a36Sopenharmony_ci * 17362306a36Sopenharmony_ci * This means that if any of the three mask/value pairs match the 17462306a36Sopenharmony_ci * instruction being decoded, then 'simulation_handler' will be used 17562306a36Sopenharmony_ci * for it. 17662306a36Sopenharmony_ci * 17762306a36Sopenharmony_ci * Both the SIMULATE and EMULATE macros have a second form which take an 17862306a36Sopenharmony_ci * additional 'regs' argument. 17962306a36Sopenharmony_ci * 18062306a36Sopenharmony_ci * DECODE_SIMULATEX(mask, value, handler, regs) 18162306a36Sopenharmony_ci * DECODE_EMULATEX (mask, value, handler, regs) 18262306a36Sopenharmony_ci * 18362306a36Sopenharmony_ci * These are used to specify what kind of CPU register is encoded in each of the 18462306a36Sopenharmony_ci * least significant 5 nibbles of the instruction being decoded. The regs value 18562306a36Sopenharmony_ci * is specified using the REGS macro, this takes any of the REG_TYPE_* values 18662306a36Sopenharmony_ci * from enum decode_reg_type as arguments; only the '*' part of the name is 18762306a36Sopenharmony_ci * given. E.g. 18862306a36Sopenharmony_ci * 18962306a36Sopenharmony_ci * REGS(0, ANY, NOPC, 0, ANY) 19062306a36Sopenharmony_ci * 19162306a36Sopenharmony_ci * This indicates an instruction is encoded like: 19262306a36Sopenharmony_ci * 19362306a36Sopenharmony_ci * bits 19..16 ignore 19462306a36Sopenharmony_ci * bits 15..12 any register allowed here 19562306a36Sopenharmony_ci * bits 11.. 8 any register except PC allowed here 19662306a36Sopenharmony_ci * bits 7.. 4 ignore 19762306a36Sopenharmony_ci * bits 3.. 0 any register allowed here 19862306a36Sopenharmony_ci * 19962306a36Sopenharmony_ci * This register specification is checked after a decode table entry is found to 20062306a36Sopenharmony_ci * match an instruction (through the mask/value test). Any invalid register then 20162306a36Sopenharmony_ci * found in the instruction will cause decoding to fail with INSN_REJECTED. In 20262306a36Sopenharmony_ci * the above example this would happen if bits 11..8 of the instruction were 20362306a36Sopenharmony_ci * 1111, indicating R15 or PC. 20462306a36Sopenharmony_ci * 20562306a36Sopenharmony_ci * As well as checking for legal combinations of registers, this data is also 20662306a36Sopenharmony_ci * used to modify the registers encoded in the instructions so that an 20762306a36Sopenharmony_ci * emulation routines can use it. (See decode_regs() and INSN_NEW_BITS.) 20862306a36Sopenharmony_ci * 20962306a36Sopenharmony_ci * Here is a real example which matches ARM instructions of the form 21062306a36Sopenharmony_ci * "AND <Rd>,<Rn>,<Rm>,<shift> <Rs>" 21162306a36Sopenharmony_ci * 21262306a36Sopenharmony_ci * DECODE_EMULATEX (0x0e000090, 0x00000010, PROBES_DATA_PROCESSING_REG, 21362306a36Sopenharmony_ci * REGS(ANY, ANY, NOPC, 0, ANY)), 21462306a36Sopenharmony_ci * ^ ^ ^ ^ 21562306a36Sopenharmony_ci * Rn Rd Rs Rm 21662306a36Sopenharmony_ci * 21762306a36Sopenharmony_ci * Decoding the instruction "AND R4, R5, R6, ASL R15" will be rejected because 21862306a36Sopenharmony_ci * Rs == R15 21962306a36Sopenharmony_ci * 22062306a36Sopenharmony_ci * Decoding the instruction "AND R4, R5, R6, ASL R7" will be accepted and the 22162306a36Sopenharmony_ci * instruction will be modified to "AND R0, R2, R3, ASL R1" and then placed into 22262306a36Sopenharmony_ci * the kprobes instruction slot. This can then be called later by the handler 22362306a36Sopenharmony_ci * function emulate_rd12rn16rm0rs8_rwflags (a pointer to which is retrieved from 22462306a36Sopenharmony_ci * the indicated slot in the action array), in order to simulate the instruction. 22562306a36Sopenharmony_ci */ 22662306a36Sopenharmony_ci 22762306a36Sopenharmony_cienum decode_type { 22862306a36Sopenharmony_ci DECODE_TYPE_END, 22962306a36Sopenharmony_ci DECODE_TYPE_TABLE, 23062306a36Sopenharmony_ci DECODE_TYPE_CUSTOM, 23162306a36Sopenharmony_ci DECODE_TYPE_SIMULATE, 23262306a36Sopenharmony_ci DECODE_TYPE_EMULATE, 23362306a36Sopenharmony_ci DECODE_TYPE_OR, 23462306a36Sopenharmony_ci DECODE_TYPE_REJECT, 23562306a36Sopenharmony_ci NUM_DECODE_TYPES /* Must be last enum */ 23662306a36Sopenharmony_ci}; 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_ci#define DECODE_TYPE_BITS 4 23962306a36Sopenharmony_ci#define DECODE_TYPE_MASK ((1 << DECODE_TYPE_BITS) - 1) 24062306a36Sopenharmony_ci 24162306a36Sopenharmony_cienum decode_reg_type { 24262306a36Sopenharmony_ci REG_TYPE_NONE = 0, /* Not a register, ignore */ 24362306a36Sopenharmony_ci REG_TYPE_ANY, /* Any register allowed */ 24462306a36Sopenharmony_ci REG_TYPE_SAMEAS16, /* Register should be same as that at bits 19..16 */ 24562306a36Sopenharmony_ci REG_TYPE_SP, /* Register must be SP */ 24662306a36Sopenharmony_ci REG_TYPE_PC, /* Register must be PC */ 24762306a36Sopenharmony_ci REG_TYPE_NOSP, /* Register must not be SP */ 24862306a36Sopenharmony_ci REG_TYPE_NOSPPC, /* Register must not be SP or PC */ 24962306a36Sopenharmony_ci REG_TYPE_NOPC, /* Register must not be PC */ 25062306a36Sopenharmony_ci REG_TYPE_NOPCWB, /* No PC if load/store write-back flag also set */ 25162306a36Sopenharmony_ci 25262306a36Sopenharmony_ci /* The following types are used when the encoding for PC indicates 25362306a36Sopenharmony_ci * another instruction form. This distiction only matters for test 25462306a36Sopenharmony_ci * case coverage checks. 25562306a36Sopenharmony_ci */ 25662306a36Sopenharmony_ci REG_TYPE_NOPCX, /* Register must not be PC */ 25762306a36Sopenharmony_ci REG_TYPE_NOSPPCX, /* Register must not be SP or PC */ 25862306a36Sopenharmony_ci 25962306a36Sopenharmony_ci /* Alias to allow '0' arg to be used in REGS macro. */ 26062306a36Sopenharmony_ci REG_TYPE_0 = REG_TYPE_NONE 26162306a36Sopenharmony_ci}; 26262306a36Sopenharmony_ci 26362306a36Sopenharmony_ci#define REGS(r16, r12, r8, r4, r0) \ 26462306a36Sopenharmony_ci (((REG_TYPE_##r16) << 16) + \ 26562306a36Sopenharmony_ci ((REG_TYPE_##r12) << 12) + \ 26662306a36Sopenharmony_ci ((REG_TYPE_##r8) << 8) + \ 26762306a36Sopenharmony_ci ((REG_TYPE_##r4) << 4) + \ 26862306a36Sopenharmony_ci (REG_TYPE_##r0)) 26962306a36Sopenharmony_ci 27062306a36Sopenharmony_ciunion decode_item { 27162306a36Sopenharmony_ci u32 bits; 27262306a36Sopenharmony_ci const union decode_item *table; 27362306a36Sopenharmony_ci int action; 27462306a36Sopenharmony_ci}; 27562306a36Sopenharmony_ci 27662306a36Sopenharmony_cistruct decode_header; 27762306a36Sopenharmony_citypedef enum probes_insn (probes_custom_decode_t)(probes_opcode_t, 27862306a36Sopenharmony_ci struct arch_probes_insn *, 27962306a36Sopenharmony_ci const struct decode_header *); 28062306a36Sopenharmony_ci 28162306a36Sopenharmony_ciunion decode_action { 28262306a36Sopenharmony_ci probes_insn_handler_t *handler; 28362306a36Sopenharmony_ci probes_custom_decode_t *decoder; 28462306a36Sopenharmony_ci}; 28562306a36Sopenharmony_ci 28662306a36Sopenharmony_citypedef enum probes_insn (probes_check_t)(probes_opcode_t, 28762306a36Sopenharmony_ci struct arch_probes_insn *, 28862306a36Sopenharmony_ci const struct decode_header *); 28962306a36Sopenharmony_ci 29062306a36Sopenharmony_cistruct decode_checker { 29162306a36Sopenharmony_ci probes_check_t *checker; 29262306a36Sopenharmony_ci}; 29362306a36Sopenharmony_ci 29462306a36Sopenharmony_ci#define DECODE_END \ 29562306a36Sopenharmony_ci {.bits = DECODE_TYPE_END} 29662306a36Sopenharmony_ci 29762306a36Sopenharmony_ci 29862306a36Sopenharmony_cistruct decode_header { 29962306a36Sopenharmony_ci union decode_item type_regs; 30062306a36Sopenharmony_ci union decode_item mask; 30162306a36Sopenharmony_ci union decode_item value; 30262306a36Sopenharmony_ci}; 30362306a36Sopenharmony_ci 30462306a36Sopenharmony_ci#define DECODE_HEADER(_type, _mask, _value, _regs) \ 30562306a36Sopenharmony_ci {.bits = (_type) | ((_regs) << DECODE_TYPE_BITS)}, \ 30662306a36Sopenharmony_ci {.bits = (_mask)}, \ 30762306a36Sopenharmony_ci {.bits = (_value)} 30862306a36Sopenharmony_ci 30962306a36Sopenharmony_ci 31062306a36Sopenharmony_cistruct decode_table { 31162306a36Sopenharmony_ci struct decode_header header; 31262306a36Sopenharmony_ci union decode_item table; 31362306a36Sopenharmony_ci}; 31462306a36Sopenharmony_ci 31562306a36Sopenharmony_ci#define DECODE_TABLE(_mask, _value, _table) \ 31662306a36Sopenharmony_ci DECODE_HEADER(DECODE_TYPE_TABLE, _mask, _value, 0), \ 31762306a36Sopenharmony_ci {.table = (_table)} 31862306a36Sopenharmony_ci 31962306a36Sopenharmony_ci 32062306a36Sopenharmony_cistruct decode_custom { 32162306a36Sopenharmony_ci struct decode_header header; 32262306a36Sopenharmony_ci union decode_item decoder; 32362306a36Sopenharmony_ci}; 32462306a36Sopenharmony_ci 32562306a36Sopenharmony_ci#define DECODE_CUSTOM(_mask, _value, _decoder) \ 32662306a36Sopenharmony_ci DECODE_HEADER(DECODE_TYPE_CUSTOM, _mask, _value, 0), \ 32762306a36Sopenharmony_ci {.action = (_decoder)} 32862306a36Sopenharmony_ci 32962306a36Sopenharmony_ci 33062306a36Sopenharmony_cistruct decode_simulate { 33162306a36Sopenharmony_ci struct decode_header header; 33262306a36Sopenharmony_ci union decode_item handler; 33362306a36Sopenharmony_ci}; 33462306a36Sopenharmony_ci 33562306a36Sopenharmony_ci#define DECODE_SIMULATEX(_mask, _value, _handler, _regs) \ 33662306a36Sopenharmony_ci DECODE_HEADER(DECODE_TYPE_SIMULATE, _mask, _value, _regs), \ 33762306a36Sopenharmony_ci {.action = (_handler)} 33862306a36Sopenharmony_ci 33962306a36Sopenharmony_ci#define DECODE_SIMULATE(_mask, _value, _handler) \ 34062306a36Sopenharmony_ci DECODE_SIMULATEX(_mask, _value, _handler, 0) 34162306a36Sopenharmony_ci 34262306a36Sopenharmony_ci 34362306a36Sopenharmony_cistruct decode_emulate { 34462306a36Sopenharmony_ci struct decode_header header; 34562306a36Sopenharmony_ci union decode_item handler; 34662306a36Sopenharmony_ci}; 34762306a36Sopenharmony_ci 34862306a36Sopenharmony_ci#define DECODE_EMULATEX(_mask, _value, _handler, _regs) \ 34962306a36Sopenharmony_ci DECODE_HEADER(DECODE_TYPE_EMULATE, _mask, _value, _regs), \ 35062306a36Sopenharmony_ci {.action = (_handler)} 35162306a36Sopenharmony_ci 35262306a36Sopenharmony_ci#define DECODE_EMULATE(_mask, _value, _handler) \ 35362306a36Sopenharmony_ci DECODE_EMULATEX(_mask, _value, _handler, 0) 35462306a36Sopenharmony_ci 35562306a36Sopenharmony_ci 35662306a36Sopenharmony_cistruct decode_or { 35762306a36Sopenharmony_ci struct decode_header header; 35862306a36Sopenharmony_ci}; 35962306a36Sopenharmony_ci 36062306a36Sopenharmony_ci#define DECODE_OR(_mask, _value) \ 36162306a36Sopenharmony_ci DECODE_HEADER(DECODE_TYPE_OR, _mask, _value, 0) 36262306a36Sopenharmony_ci 36362306a36Sopenharmony_cienum probes_insn { 36462306a36Sopenharmony_ci INSN_REJECTED, 36562306a36Sopenharmony_ci INSN_GOOD, 36662306a36Sopenharmony_ci INSN_GOOD_NO_SLOT 36762306a36Sopenharmony_ci}; 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_cistruct decode_reject { 37062306a36Sopenharmony_ci struct decode_header header; 37162306a36Sopenharmony_ci}; 37262306a36Sopenharmony_ci 37362306a36Sopenharmony_ci#define DECODE_REJECT(_mask, _value) \ 37462306a36Sopenharmony_ci DECODE_HEADER(DECODE_TYPE_REJECT, _mask, _value, 0) 37562306a36Sopenharmony_ci 37662306a36Sopenharmony_ciprobes_insn_handler_t probes_simulate_nop; 37762306a36Sopenharmony_ciprobes_insn_handler_t probes_emulate_none; 37862306a36Sopenharmony_ci 37962306a36Sopenharmony_ciint __kprobes 38062306a36Sopenharmony_ciprobes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi, 38162306a36Sopenharmony_ci const union decode_item *table, bool thumb, bool emulate, 38262306a36Sopenharmony_ci const union decode_action *actions, 38362306a36Sopenharmony_ci const struct decode_checker **checkers); 38462306a36Sopenharmony_ci 38562306a36Sopenharmony_ci#endif 386