/arch/x86/lib/ |
D | insn.c | 30 #define validate_next(t, insn, n) \ argument 31 ((insn)->next_byte + sizeof(t) + n <= (insn)->end_kaddr) 33 #define __get_next(t, insn) \ argument 34 ({ t r = *(t*)insn->next_byte; insn->next_byte += sizeof(t); r; }) 36 #define __peek_nbyte_next(t, insn, n) \ argument 37 ({ t r = *(t*)((insn)->next_byte + n); r; }) 39 #define get_next(t, insn) \ argument 40 ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); }) 42 #define peek_nbyte_next(t, insn, n) \ argument 43 ({ if (unlikely(!validate_next(t, insn, n))) goto err_out; __peek_nbyte_next(t, insn, n); }) [all …]
|
/arch/x86/include/asm/ |
D | insn.h | 36 struct insn { struct 100 extern void insn_init(struct insn *insn, const void *kaddr, int buf_len, int x86_64); 101 extern void insn_get_prefixes(struct insn *insn); 102 extern void insn_get_opcode(struct insn *insn); 103 extern void insn_get_modrm(struct insn *insn); 104 extern void insn_get_sib(struct insn *insn); 105 extern void insn_get_displacement(struct insn *insn); 106 extern void insn_get_immediate(struct insn *insn); 107 extern void insn_get_length(struct insn *insn); 110 static inline void insn_get_attribute(struct insn *insn) in insn_get_attribute() argument [all …]
|
/arch/powerpc/xmon/ |
D | spu.h | 91 #define SIGNED_EXTRACT(insn,size,pos) (((int)((insn) << (32-size-pos))) >> (32-size)) argument 92 #define UNSIGNED_EXTRACT(insn,size,pos) (((insn) >> pos) & ((1 << size)-1)) argument 94 #define DECODE_INSN_RT(insn) (insn & 0x7f) argument 95 #define DECODE_INSN_RA(insn) ((insn >> 7) & 0x7f) argument 96 #define DECODE_INSN_RB(insn) ((insn >> 14) & 0x7f) argument 97 #define DECODE_INSN_RC(insn) ((insn >> 21) & 0x7f) argument 99 #define DECODE_INSN_I10(insn) SIGNED_EXTRACT(insn,10,14) argument 100 #define DECODE_INSN_U10(insn) UNSIGNED_EXTRACT(insn,10,14) argument 103 #define DECODE_INSN_I16(insn) SIGNED_EXTRACT(insn,16,7) argument 104 #define DECODE_INSN_U16(insn) UNSIGNED_EXTRACT(insn,16,7) argument [all …]
|
D | spu-dis.c | 55 get_index_for_opcode (unsigned int insn) in get_index_for_opcode() argument 58 unsigned int opcode = insn >> (32-11); in get_index_for_opcode() 94 print_insn_spu (unsigned long insn, unsigned long memaddr) in print_insn_spu() argument 101 index = get_index_for_opcode (insn); in print_insn_spu() 105 printf(".long 0x%x", insn); in print_insn_spu() 117 int fb = (insn >> (32-18)) & 0x7f; in print_insn_spu() 138 DECODE_INSN_RT (insn)); in print_insn_spu() 142 DECODE_INSN_RA (insn)); in print_insn_spu() 146 DECODE_INSN_RB (insn)); in print_insn_spu() 150 DECODE_INSN_RC (insn)); in print_insn_spu() [all …]
|
/arch/arm64/kernel/ |
D | insn.c | 57 enum aarch64_insn_encoding_class __kprobes aarch64_get_insn_class(u32 insn) in aarch64_get_insn_class() argument 59 return aarch64_insn_encoding_class[(insn >> 25) & 0xf]; in aarch64_get_insn_class() 63 bool __kprobes aarch64_insn_is_nop(u32 insn) in aarch64_insn_is_nop() argument 65 if (!aarch64_insn_is_hint(insn)) in aarch64_insn_is_nop() 68 switch (insn & 0xFE0) { in aarch64_insn_is_nop() 80 bool aarch64_insn_is_branch_imm(u32 insn) in aarch64_insn_is_branch_imm() argument 82 return (aarch64_insn_is_b(insn) || aarch64_insn_is_bl(insn) || in aarch64_insn_is_branch_imm() 83 aarch64_insn_is_tbz(insn) || aarch64_insn_is_tbnz(insn) || in aarch64_insn_is_branch_imm() 84 aarch64_insn_is_cbz(insn) || aarch64_insn_is_cbnz(insn) || in aarch64_insn_is_branch_imm() 85 aarch64_insn_is_bcond(insn)); in aarch64_insn_is_branch_imm() [all …]
|
D | armv8_deprecated.c | 93 struct insn_emulation *insn = (struct insn_emulation *)data; in enable_insn_hw_mode() local 94 if (insn->ops->set_hw_mode) in enable_insn_hw_mode() 95 insn->ops->set_hw_mode(true); in enable_insn_hw_mode() 100 struct insn_emulation *insn = (struct insn_emulation *)data; in disable_insn_hw_mode() local 101 if (insn->ops->set_hw_mode) in disable_insn_hw_mode() 102 insn->ops->set_hw_mode(false); in disable_insn_hw_mode() 106 static int run_all_cpu_set_hw_mode(struct insn_emulation *insn, bool enable) in run_all_cpu_set_hw_mode() argument 108 if (!insn->ops->set_hw_mode) in run_all_cpu_set_hw_mode() 111 on_each_cpu(enable_insn_hw_mode, (void *)insn, true); in run_all_cpu_set_hw_mode() 113 on_each_cpu(disable_insn_hw_mode, (void *)insn, true); in run_all_cpu_set_hw_mode() [all …]
|
/arch/s390/lib/ |
D | probes.c | 10 int probe_is_prohibited_opcode(u16 *insn) in probe_is_prohibited_opcode() argument 12 if (!is_known_insn((unsigned char *)insn)) in probe_is_prohibited_opcode() 14 switch (insn[0] >> 8) { in probe_is_prohibited_opcode() 23 switch (insn[0] & 0x0f) { in probe_is_prohibited_opcode() 28 switch (insn[0]) { in probe_is_prohibited_opcode() 44 int probe_get_fixup_type(u16 *insn) in probe_get_fixup_type() argument 49 switch (insn[0] >> 8) { in probe_get_fixup_type() 54 if ((insn[0] & 0x0f) == 0) in probe_get_fixup_type() 75 if ((insn[0] & 0xff) == 0xb2) in probe_get_fixup_type() 79 if ((insn[0] & 0x0f) == 0x05) in probe_get_fixup_type() [all …]
|
/arch/m32r/kernel/ |
D | align.c | 38 #define REG1(insn) (((insn) & 0x0f00) >> 8) argument 39 #define REG2(insn) ((insn) & 0x000f) argument 81 static int emu_addi(unsigned short insn, struct pt_regs *regs) in emu_addi() argument 83 char imm = (char)(insn & 0xff); in emu_addi() 84 int dest = REG1(insn); in emu_addi() 94 static int emu_ldi(unsigned short insn, struct pt_regs *regs) in emu_ldi() argument 96 char imm = (char)(insn & 0xff); in emu_ldi() 98 set_reg(regs, REG1(insn), (int)imm); in emu_ldi() 103 static int emu_add(unsigned short insn, struct pt_regs *regs) in emu_add() argument 105 int dest = REG1(insn); in emu_add() [all …]
|
/arch/arm/probes/kprobes/ |
D | actions-thumb.c | 27 t32_simulate_table_branch(probes_opcode_t insn, in t32_simulate_table_branch() argument 31 int rn = (insn >> 16) & 0xf; in t32_simulate_table_branch() 32 int rm = insn & 0xf; in t32_simulate_table_branch() 38 if (insn & 0x10) /* TBH */ in t32_simulate_table_branch() 47 t32_simulate_mrs(probes_opcode_t insn, in t32_simulate_mrs() argument 50 int rd = (insn >> 8) & 0xf; in t32_simulate_mrs() 56 t32_simulate_cond_branch(probes_opcode_t insn, in t32_simulate_cond_branch() argument 61 long offset = insn & 0x7ff; /* imm11 */ in t32_simulate_cond_branch() 62 offset += (insn & 0x003f0000) >> 5; /* imm6 */ in t32_simulate_cond_branch() 63 offset += (insn & 0x00002000) << 4; /* J1 */ in t32_simulate_cond_branch() [all …]
|
D | actions-common.c | 21 static void __kprobes simulate_ldm1stm1(probes_opcode_t insn, in simulate_ldm1stm1() argument 25 int rn = (insn >> 16) & 0xf; in simulate_ldm1stm1() 26 int lbit = insn & (1 << 20); in simulate_ldm1stm1() 27 int wbit = insn & (1 << 21); in simulate_ldm1stm1() 28 int ubit = insn & (1 << 23); in simulate_ldm1stm1() 29 int pbit = insn & (1 << 24); in simulate_ldm1stm1() 35 reg_bit_vector = insn & 0xffff; in simulate_ldm1stm1() 45 reg_bit_vector = insn & 0xffff; in simulate_ldm1stm1() 63 static void __kprobes simulate_stm1_pc(probes_opcode_t insn, in simulate_stm1_pc() argument 70 simulate_ldm1stm1(insn, asi, regs); in simulate_stm1_pc() [all …]
|
D | checkers-common.c | 21 enum probes_insn checker_stack_use_none(probes_opcode_t insn, in checker_stack_use_none() argument 29 enum probes_insn checker_stack_use_unknown(probes_opcode_t insn, in checker_stack_use_unknown() argument 38 enum probes_insn checker_stack_use_imm_0xx(probes_opcode_t insn, in checker_stack_use_imm_0xx() argument 42 int imm = insn & 0xff; in checker_stack_use_imm_0xx() 51 enum probes_insn checker_stack_use_t32strd(probes_opcode_t insn, in checker_stack_use_t32strd() argument 55 int imm = insn & 0xff; in checker_stack_use_t32strd() 60 enum probes_insn checker_stack_use_imm_x0x(probes_opcode_t insn, in checker_stack_use_imm_x0x() argument 64 int imm = ((insn & 0xf00) >> 4) + (insn & 0xf); in checker_stack_use_imm_x0x() 70 enum probes_insn checker_stack_use_imm_xxx(probes_opcode_t insn, in checker_stack_use_imm_xxx() argument 74 int imm = insn & 0xfff; in checker_stack_use_imm_xxx() [all …]
|
D | actions-arm.c | 77 emulate_ldrdstrd(probes_opcode_t insn, in emulate_ldrdstrd() argument 81 int rt = (insn >> 12) & 0xf; in emulate_ldrdstrd() 82 int rn = (insn >> 16) & 0xf; in emulate_ldrdstrd() 83 int rm = insn & 0xf; in emulate_ldrdstrd() 101 if (is_writeback(insn)) in emulate_ldrdstrd() 106 emulate_ldr(probes_opcode_t insn, in emulate_ldr() argument 110 int rt = (insn >> 12) & 0xf; in emulate_ldr() 111 int rn = (insn >> 16) & 0xf; in emulate_ldr() 112 int rm = insn & 0xf; in emulate_ldr() 131 if (is_writeback(insn)) in emulate_ldr() [all …]
|
/arch/sparc/kernel/ |
D | unaligned_32.c | 32 static inline enum direction decode_direction(unsigned int insn) in decode_direction() argument 34 unsigned long tmp = (insn >> 21) & 1; in decode_direction() 39 if(((insn>>19)&0x3f) == 15) in decode_direction() 47 static inline int decode_access_size(unsigned int insn) in decode_access_size() argument 49 insn = (insn >> 19) & 3; in decode_access_size() 51 if(!insn) in decode_access_size() 53 else if(insn == 3) in decode_access_size() 55 else if(insn == 2) in decode_access_size() 58 printk("Impossible unaligned trap. insn=%08x\n", insn); in decode_access_size() 65 static inline int decode_signedness(unsigned int insn) in decode_signedness() argument [all …]
|
D | unaligned_64.c | 41 static inline enum direction decode_direction(unsigned int insn) in decode_direction() argument 43 unsigned long tmp = (insn >> 21) & 1; in decode_direction() 48 switch ((insn>>19)&0xf) { in decode_direction() 58 static inline int decode_access_size(struct pt_regs *regs, unsigned int insn) in decode_access_size() argument 62 tmp = ((insn >> 19) & 0xf); in decode_access_size() 73 printk("Impossible unaligned trap. insn=%08x\n", insn); in decode_access_size() 86 static inline int decode_asi(unsigned int insn, struct pt_regs *regs) in decode_asi() argument 88 if (insn & 0x800000) { in decode_asi() 89 if (insn & 0x2000) in decode_asi() 92 return (unsigned char)(insn >> 5); /* imm_asi */ in decode_asi() [all …]
|
D | visemul.c | 293 static void edge(struct pt_regs *regs, unsigned int insn, unsigned int opf) in edge() argument 298 maybe_flush_windows(RS1(insn), RS2(insn), RD(insn), 0); in edge() 299 orig_rs1 = rs1 = fetch_reg(RS1(insn), regs); in edge() 300 orig_rs2 = rs2 = fetch_reg(RS2(insn), regs); in edge() 349 store_reg(regs, rd_val, RD(insn)); in edge() 371 static void array(struct pt_regs *regs, unsigned int insn, unsigned int opf) in array() argument 376 maybe_flush_windows(RS1(insn), RS2(insn), RD(insn), 0); in array() 377 rs1 = fetch_reg(RS1(insn), regs); in array() 378 rs2 = fetch_reg(RS2(insn), regs); in array() 402 store_reg(regs, rd_val, RD(insn)); in array() [all …]
|
/arch/mips/kernel/ |
D | branch.c | 60 union mips_instruction insn = (union mips_instruction)dec_insn.insn; in __mm_isBranchInstr() local 68 switch (insn.mm_i_format.opcode) { in __mm_isBranchInstr() 70 if ((insn.mm_i_format.simmediate & MM_POOL32A_MINOR_MASK) == in __mm_isBranchInstr() 72 switch (insn.mm_i_format.simmediate >> in __mm_isBranchInstr() 78 if (insn.mm_i_format.rt != 0) /* Not mm_jr */ in __mm_isBranchInstr() 79 regs->regs[insn.mm_i_format.rt] = in __mm_isBranchInstr() 83 *contpc = regs->regs[insn.mm_i_format.rs]; in __mm_isBranchInstr() 89 switch (insn.mm_i_format.rt) { in __mm_isBranchInstr() 97 if ((long)regs->regs[insn.mm_i_format.rs] < 0) in __mm_isBranchInstr() 100 (insn.mm_i_format.simmediate << 1); in __mm_isBranchInstr() [all …]
|
/arch/x86/tools/ |
D | insn_sanity.c | 80 static void dump_insn(FILE *fp, struct insn *insn) in dump_insn() argument 83 dump_field(fp, "prefixes", "\t", &insn->prefixes); in dump_insn() 84 dump_field(fp, "rex_prefix", "\t", &insn->rex_prefix); in dump_insn() 85 dump_field(fp, "vex_prefix", "\t", &insn->vex_prefix); in dump_insn() 86 dump_field(fp, "opcode", "\t", &insn->opcode); in dump_insn() 87 dump_field(fp, "modrm", "\t", &insn->modrm); in dump_insn() 88 dump_field(fp, "sib", "\t", &insn->sib); in dump_insn() 89 dump_field(fp, "displacement", "\t", &insn->displacement); in dump_insn() 90 dump_field(fp, "immediate1", "\t", &insn->immediate1); in dump_insn() 91 dump_field(fp, "immediate2", "\t", &insn->immediate2); in dump_insn() [all …]
|
D | test_get_len.c | 70 static void dump_insn(FILE *fp, struct insn *insn) in dump_insn() argument 73 dump_field(fp, "prefixes", "\t", &insn->prefixes); in dump_insn() 74 dump_field(fp, "rex_prefix", "\t", &insn->rex_prefix); in dump_insn() 75 dump_field(fp, "vex_prefix", "\t", &insn->vex_prefix); in dump_insn() 76 dump_field(fp, "opcode", "\t", &insn->opcode); in dump_insn() 77 dump_field(fp, "modrm", "\t", &insn->modrm); in dump_insn() 78 dump_field(fp, "sib", "\t", &insn->sib); in dump_insn() 79 dump_field(fp, "displacement", "\t", &insn->displacement); in dump_insn() 80 dump_field(fp, "immediate1", "\t", &insn->immediate1); in dump_insn() 81 dump_field(fp, "immediate2", "\t", &insn->immediate2); in dump_insn() [all …]
|
/arch/s390/include/asm/ |
D | ftrace.h | 42 static inline void ftrace_generate_nop_insn(struct ftrace_insn *insn) in ftrace_generate_nop_insn() argument 47 insn->opc = 0xc004; in ftrace_generate_nop_insn() 48 insn->disp = 0; in ftrace_generate_nop_insn() 51 insn->opc = 0xc0f4; in ftrace_generate_nop_insn() 52 insn->disp = MCOUNT_INSN_SIZE / 2; in ftrace_generate_nop_insn() 57 static inline int is_ftrace_nop(struct ftrace_insn *insn) in is_ftrace_nop() argument 61 if (insn->disp == 0) in is_ftrace_nop() 64 if (insn->disp == MCOUNT_INSN_SIZE / 2) in is_ftrace_nop() 71 static inline void ftrace_generate_call_insn(struct ftrace_insn *insn, in ftrace_generate_call_insn() argument 79 insn->opc = 0xc005; in ftrace_generate_call_insn() [all …]
|
/arch/arm/probes/ |
D | decode.c | 199 prepare_emulated_insn(probes_opcode_t insn, struct arch_probes_insn *asi, in prepare_emulated_insn() argument 204 u16 *thumb_insn = (u16 *)asi->insn; in prepare_emulated_insn() 208 return insn; in prepare_emulated_insn() 210 asi->insn[1] = __opcode_to_mem_arm(0xe12fff1e); /* ARM bx lr */ in prepare_emulated_insn() 212 asi->insn[1] = __opcode_to_mem_arm(0xe1a0f00e); /* mov pc, lr */ in prepare_emulated_insn() 215 if (insn < 0xe0000000) in prepare_emulated_insn() 216 insn = (insn | 0xe0000000) & ~0x10000000; in prepare_emulated_insn() 217 return insn; in prepare_emulated_insn() 225 set_emulated_insn(probes_opcode_t insn, struct arch_probes_insn *asi, in set_emulated_insn() argument 230 u16 *ip = (u16 *)asi->insn; in set_emulated_insn() [all …]
|
/arch/x86/kernel/ |
D | uprobes.c | 54 #define OPCODE1(insn) ((insn)->opcode.bytes[0]) argument 55 #define OPCODE2(insn) ((insn)->opcode.bytes[1]) argument 56 #define OPCODE3(insn) ((insn)->opcode.bytes[2]) argument 57 #define MODRM_REG(insn) X86_MODRM_REG((insn)->modrm.value) argument 269 static bool is_prefix_bad(struct insn *insn) in is_prefix_bad() argument 274 for_each_insn_prefix(insn, i, p) { in is_prefix_bad() 287 static int uprobe_init_insn(struct arch_uprobe *auprobe, struct insn *insn, bool x86_64) in uprobe_init_insn() argument 291 insn_init(insn, auprobe->insn, sizeof(auprobe->insn), x86_64); in uprobe_init_insn() 293 insn_get_length(insn); in uprobe_init_insn() 294 if (!insn_complete(insn)) in uprobe_init_insn() [all …]
|
/arch/x86/kernel/kprobes/ |
D | opt.c | 195 static int __insn_is_indirect_jump(struct insn *insn) in __insn_is_indirect_jump() argument 197 return ((insn->opcode.bytes[0] == 0xff && in __insn_is_indirect_jump() 198 (X86_MODRM_REG(insn->modrm.value) & 6) == 4) || /* Jump */ in __insn_is_indirect_jump() 199 insn->opcode.bytes[0] == 0xea); /* Segment based jump */ in __insn_is_indirect_jump() 203 static int insn_jump_into_range(struct insn *insn, unsigned long start, int len) in insn_jump_into_range() argument 207 switch (insn->opcode.bytes[0]) { in insn_jump_into_range() 216 if ((insn->opcode.bytes[1] & 0xf0) == 0x80) /* jcc near */ in insn_jump_into_range() 220 if ((insn->opcode.bytes[0] & 0xf0) == 0x70) /* jcc short */ in insn_jump_into_range() 224 target = (unsigned long)insn->next_byte + insn->immediate.value; in insn_jump_into_range() 229 static int insn_is_indirect_jump(struct insn *insn) in insn_is_indirect_jump() argument [all …]
|
/arch/s390/include/uapi/asm/ |
D | sie.h | 222 #define INSN_DECODE_IPA0(ipa0, insn, rshift, mask) \ argument 223 (insn >> 56) == (ipa0) ? \ 224 ((ipa0 << 8) | ((insn >> rshift) & mask)) : 226 #define INSN_DECODE(insn) (insn >> 56) argument 233 #define icpt_insn_decoder(insn) ( \ argument 234 INSN_DECODE_IPA0(0x01, insn, 48, 0xff) \ 235 INSN_DECODE_IPA0(0xaa, insn, 48, 0x0f) \ 236 INSN_DECODE_IPA0(0xb2, insn, 48, 0xff) \ 237 INSN_DECODE_IPA0(0xb9, insn, 48, 0xff) \ 238 INSN_DECODE_IPA0(0xe3, insn, 48, 0xff) \ [all …]
|
/arch/sparc/mm/ |
D | fault_64.c | 99 u32 insn = 0; in get_user_insn() local 124 : "=r" (insn) in get_user_insn() 137 : "=r" (insn) in get_user_insn() 145 return insn; in get_user_insn() 170 unsigned long fault_addr, unsigned int insn, in do_fault_siginfo() argument 186 if (insn) in do_fault_siginfo() 187 addr = compute_effective_address(regs, insn, 0); in do_fault_siginfo() 200 static unsigned int get_fault_insn(struct pt_regs *regs, unsigned int insn) in get_fault_insn() argument 202 if (!insn) { in get_fault_insn() 206 insn = *(unsigned int *) regs->tpc; in get_fault_insn() [all …]
|
/arch/s390/kernel/ |
D | jump_label.c | 15 struct insn { struct 25 static void jump_label_make_nop(struct jump_entry *entry, struct insn *insn) in jump_label_make_nop() argument 28 insn->opcode = 0xc004; in jump_label_make_nop() 29 insn->offset = 0; in jump_label_make_nop() 32 static void jump_label_make_branch(struct jump_entry *entry, struct insn *insn) in jump_label_make_branch() argument 35 insn->opcode = 0xc0f4; in jump_label_make_branch() 36 insn->offset = (entry->target - entry->code) >> 1; in jump_label_make_branch() 39 static void jump_label_bug(struct jump_entry *entry, struct insn *expected, in jump_label_bug() 40 struct insn *new) in jump_label_bug() 53 static struct insn orignop = { [all …]
|