Lines Matching refs:code
238 return insn->code == (BPF_JMP | BPF_CALL) && in bpf_pseudo_call()
244 return insn->code == (BPF_JMP | BPF_CALL) && in bpf_pseudo_kfunc_call()
540 return BPF_CLASS(insn->code) == BPF_STX && in is_cmpxchg_insn()
541 BPF_MODE(insn->code) == BPF_ATOMIC && in is_cmpxchg_insn()
2244 u8 code = insn[i].code; in check_subprogs() local
2246 if (code == (BPF_JMP | BPF_CALL) && in check_subprogs()
2250 if (BPF_CLASS(code) == BPF_LD && in check_subprogs()
2251 (BPF_MODE(code) == BPF_ABS || BPF_MODE(code) == BPF_IND)) in check_subprogs()
2253 if (BPF_CLASS(code) != BPF_JMP && BPF_CLASS(code) != BPF_JMP32) in check_subprogs()
2255 if (BPF_OP(code) == BPF_EXIT || BPF_OP(code) == BPF_CALL) in check_subprogs()
2268 if (code != (BPF_JMP | BPF_EXIT) && in check_subprogs()
2269 code != (BPF_JMP | BPF_JA)) { in check_subprogs()
2340 u8 code, class, op; in is_reg64() local
2342 code = insn->code; in is_reg64()
2343 class = BPF_CLASS(code); in is_reg64()
2344 op = BPF_OP(code); in is_reg64()
2379 return BPF_SIZE(code) == BPF_DW; in is_reg64()
2391 return BPF_SIZE(code) == BPF_DW; in is_reg64()
2395 u8 mode = BPF_MODE(code); in is_reg64()
2424 switch (BPF_CLASS(insn->code)) { in insn_def_regno()
2430 if (BPF_MODE(insn->code) == BPF_ATOMIC && in insn_def_regno()
2598 u8 class = BPF_CLASS(insn->code); in backtrack_insn()
2599 u8 opcode = BPF_OP(insn->code); in backtrack_insn()
2600 u8 mode = BPF_MODE(insn->code); in backtrack_insn()
2605 if (insn->code == 0) in backtrack_insn()
2622 if (BPF_SRC(insn->code) == BPF_X) { in backtrack_insn()
2639 if (BPF_SRC(insn->code) == BPF_X) { in backtrack_insn()
2722 } else if (BPF_SRC(insn->code) == BPF_X) { in backtrack_insn()
3245 return BPF_CLASS(insn->code) == BPF_ST && BPF_MODE(insn->code) == BPF_MEM; in is_bpf_st_mem()
4002 int class = BPF_CLASS(insn->code); in check_map_kptr_access()
4012 if (BPF_MODE(insn->code) != BPF_MEM) { in check_map_kptr_access()
5235 if (BPF_SIZE(insn->code) != BPF_W && BPF_SIZE(insn->code) != BPF_DW) { in check_atomic()
5300 BPF_SIZE(insn->code), BPF_READ, -1, true); in check_atomic()
5303 BPF_SIZE(insn->code), BPF_READ, load_reg, in check_atomic()
5310 BPF_SIZE(insn->code), BPF_WRITE, -1, true); in check_atomic()
6972 if (insn->code == (BPF_JMP | BPF_CALL) && in __check_func_call()
8198 return env->bypass_spec_v1 || BPF_SRC(insn->code) == BPF_K; in can_skip_alu_sanitation()
8250 if (BPF_SRC(insn->code) == BPF_K) { in sanitize_speculative_path()
8252 } else if (BPF_SRC(insn->code) == BPF_X) { in sanitize_speculative_path()
8273 u8 opcode = BPF_OP(insn->code); in sanitize_ptr_alu()
8375 const char *op = BPF_OP(insn->code) == BPF_ADD ? "add" : "sub"; in sanitize_err()
8493 u8 opcode = BPF_OP(insn->code); in adjust_ptr_min_max_vals()
8508 if (BPF_CLASS(insn->code) != BPF_ALU64) { in adjust_ptr_min_max_vals()
9286 u8 opcode = BPF_OP(insn->code); in adjust_scalar_min_max_vals()
9292 u64 insn_bitness = (BPF_CLASS(insn->code) == BPF_ALU64) ? 64 : 32; in adjust_scalar_min_max_vals()
9293 bool alu32 = (BPF_CLASS(insn->code) != BPF_ALU64); in adjust_scalar_min_max_vals()
9448 u8 opcode = BPF_OP(insn->code); in adjust_reg_min_max_vals()
9460 if (BPF_SRC(insn->code) == BPF_X) { in adjust_reg_min_max_vals()
9530 u8 opcode = BPF_OP(insn->code); in check_alu_op()
9535 if (BPF_SRC(insn->code) != BPF_K || in check_alu_op()
9544 BPF_CLASS(insn->code) == BPF_ALU64) { in check_alu_op()
9568 if (BPF_SRC(insn->code) == BPF_X) { in check_alu_op()
9590 if (BPF_SRC(insn->code) == BPF_X) { in check_alu_op()
9594 if (BPF_CLASS(insn->code) == BPF_ALU64) { in check_alu_op()
9637 if (BPF_CLASS(insn->code) == BPF_ALU64) { in check_alu_op()
9652 if (BPF_SRC(insn->code) == BPF_X) { in check_alu_op()
9674 BPF_SRC(insn->code) == BPF_K && insn->imm == 0) { in check_alu_op()
9680 opcode == BPF_ARSH) && BPF_SRC(insn->code) == BPF_K) { in check_alu_op()
9681 int size = BPF_CLASS(insn->code) == BPF_ALU64 ? 64 : 32; in check_alu_op()
10304 if (BPF_SRC(insn->code) != BPF_X) in try_match_pkt_pointers()
10308 if (BPF_CLASS(insn->code) == BPF_JMP32) in try_match_pkt_pointers()
10311 switch (BPF_OP(insn->code)) { in try_match_pkt_pointers()
10422 u8 opcode = BPF_OP(insn->code); in check_cond_jmp_op()
10439 if (BPF_SRC(insn->code) == BPF_X) { in check_cond_jmp_op()
10464 is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32; in check_cond_jmp_op()
10466 if (BPF_SRC(insn->code) == BPF_K) { in check_cond_jmp_op()
10492 if (BPF_SRC(insn->code) == BPF_X && !err && in check_cond_jmp_op()
10540 if (BPF_SRC(insn->code) == BPF_X) { in check_cond_jmp_op()
10590 if (!is_jmp32 && BPF_SRC(insn->code) == BPF_K && in check_cond_jmp_op()
10621 if (BPF_SIZE(insn->code) != BPF_DW) { in check_ld_imm()
10736 u8 mode = BPF_MODE(insn->code); in check_ld_abs()
10750 BPF_SIZE(insn->code) == BPF_DW || in check_ld_abs()
11127 if (BPF_CLASS(insns[t].code) != BPF_JMP && in visit_insn()
11128 BPF_CLASS(insns[t].code) != BPF_JMP32) in visit_insn()
11131 switch (BPF_OP(insns[t].code)) { in visit_insn()
11147 if (BPF_SRC(insns[t].code) != BPF_K) in visit_insn()
11491 if (!prog->insnsi[linfo[i].insn_off].code) { in check_btf_line()
12478 class = BPF_CLASS(insn->code); in do_check()
12573 insn->off, BPF_SIZE(insn->code), in do_check()
12602 if (BPF_MODE(insn->code) == BPF_ATOMIC) { in do_check()
12610 if (BPF_MODE(insn->code) != BPF_MEM || insn->imm != 0) { in do_check()
12628 insn->off, BPF_SIZE(insn->code), in do_check()
12643 if (BPF_MODE(insn->code) != BPF_MEM || in do_check()
12662 insn->off, BPF_SIZE(insn->code), in do_check()
12668 u8 opcode = BPF_OP(insn->code); in do_check()
12672 if (BPF_SRC(insn->code) != BPF_K || in do_check()
12699 if (BPF_SRC(insn->code) != BPF_K || in do_check()
12712 if (BPF_SRC(insn->code) != BPF_K || in do_check()
12767 u8 mode = BPF_MODE(insn->code); in do_check()
13062 if (BPF_CLASS(insn->code) == BPF_LDX && in resolve_pseudo_ldimm64()
13063 (BPF_MODE(insn->code) != BPF_MEM || insn->imm != 0)) { in resolve_pseudo_ldimm64()
13068 if (insn[0].code == (BPF_LD | BPF_IMM | BPF_DW)) { in resolve_pseudo_ldimm64()
13075 if (i == insn_cnt - 1 || insn[1].code != 0 || in resolve_pseudo_ldimm64()
13221 if (!bpf_opcode_in_insntable(insn->code)) { in resolve_pseudo_ldimm64()
13222 verbose(env, "unknown opcode %02x\n", insn->code); in resolve_pseudo_ldimm64()
13256 if (insn->code != (BPF_LD | BPF_IMM | BPF_DW)) in convert_pseudo_ld_imm64()
13530 static bool insn_is_cond_jump(u8 code) in insn_is_cond_jump() argument
13534 if (BPF_CLASS(code) == BPF_JMP32) in insn_is_cond_jump()
13537 if (BPF_CLASS(code) != BPF_JMP) in insn_is_cond_jump()
13540 op = BPF_OP(code); in insn_is_cond_jump()
13553 if (!insn_is_cond_jump(insn->code)) in opt_hard_wire_dead_code_branches()
13638 u8 code, class; in opt_subreg_zext_lo32_rnd_hi32() local
13644 code = insn.code; in opt_subreg_zext_lo32_rnd_hi32()
13645 class = BPF_CLASS(code); in opt_subreg_zext_lo32_rnd_hi32()
13655 BPF_MODE(code) == BPF_IMM) in opt_subreg_zext_lo32_rnd_hi32()
13759 if (insn->code == (BPF_LDX | BPF_MEM | BPF_B) || in convert_ctx_accesses()
13760 insn->code == (BPF_LDX | BPF_MEM | BPF_H) || in convert_ctx_accesses()
13761 insn->code == (BPF_LDX | BPF_MEM | BPF_W) || in convert_ctx_accesses()
13762 insn->code == (BPF_LDX | BPF_MEM | BPF_DW)) { in convert_ctx_accesses()
13765 } else if (insn->code == (BPF_STX | BPF_MEM | BPF_B) || in convert_ctx_accesses()
13766 insn->code == (BPF_STX | BPF_MEM | BPF_H) || in convert_ctx_accesses()
13767 insn->code == (BPF_STX | BPF_MEM | BPF_W) || in convert_ctx_accesses()
13768 insn->code == (BPF_STX | BPF_MEM | BPF_DW) || in convert_ctx_accesses()
13769 insn->code == (BPF_ST | BPF_MEM | BPF_B) || in convert_ctx_accesses()
13770 insn->code == (BPF_ST | BPF_MEM | BPF_H) || in convert_ctx_accesses()
13771 insn->code == (BPF_ST | BPF_MEM | BPF_W) || in convert_ctx_accesses()
13772 insn->code == (BPF_ST | BPF_MEM | BPF_DW)) { in convert_ctx_accesses()
13774 ctx_access = BPF_CLASS(insn->code) == BPF_STX; in convert_ctx_accesses()
13819 insn->code = BPF_LDX | BPF_PROBE_MEM | in convert_ctx_accesses()
13820 BPF_SIZE((insn)->code); in convert_ctx_accesses()
13854 insn->code = BPF_LDX | BPF_MEM | size_code; in convert_ctx_accesses()
14007 if (BPF_CLASS(insn->code) == BPF_LDX && in jit_subprogs()
14008 BPF_MODE(insn->code) == BPF_PROBE_MEM) in jit_subprogs()
14231 if (insn->code == (BPF_ALU64 | BPF_MOD | BPF_X) || in do_misc_fixups()
14232 insn->code == (BPF_ALU64 | BPF_DIV | BPF_X) || in do_misc_fixups()
14233 insn->code == (BPF_ALU | BPF_MOD | BPF_X) || in do_misc_fixups()
14234 insn->code == (BPF_ALU | BPF_DIV | BPF_X)) { in do_misc_fixups()
14235 bool is64 = BPF_CLASS(insn->code) == BPF_ALU64; in do_misc_fixups()
14236 bool isdiv = BPF_OP(insn->code) == BPF_DIV; in do_misc_fixups()
14272 if (BPF_CLASS(insn->code) == BPF_LD && in do_misc_fixups()
14273 (BPF_MODE(insn->code) == BPF_ABS || in do_misc_fixups()
14274 BPF_MODE(insn->code) == BPF_IND)) { in do_misc_fixups()
14292 if (insn->code == (BPF_ALU64 | BPF_ADD | BPF_X) || in do_misc_fixups()
14293 insn->code == (BPF_ALU64 | BPF_SUB | BPF_X)) { in do_misc_fixups()
14327 insn->code = insn->code == code_add ? in do_misc_fixups()
14344 if (insn->code != (BPF_JMP | BPF_CALL)) in do_misc_fixups()
14378 insn->code = BPF_JMP | BPF_TAIL_CALL; in do_misc_fixups()
14809 return insn->code == (BPF_JMP | BPF_CALL) && in is_bpf_loop_call()