Home
last modified time | relevance | path

Searched refs:imm (Results 1 – 25 of 139) sorted by relevance

123456

/linux-6.1.9/arch/powerpc/net/
Dbpf_jit_comp32.c292 s32 imm = insn[i].imm; in bpf_jit_build_body() local
345 imm = -imm; in bpf_jit_build_body()
348 if (IMM_HA(imm) & 0xffff) in bpf_jit_build_body()
349 EMIT(PPC_RAW_ADDIS(dst_reg, dst_reg, IMM_HA(imm))); in bpf_jit_build_body()
350 if (IMM_L(imm)) in bpf_jit_build_body()
351 EMIT(PPC_RAW_ADDI(dst_reg, dst_reg, IMM_L(imm))); in bpf_jit_build_body()
354 imm = -imm; in bpf_jit_build_body()
357 if (!imm) in bpf_jit_build_body()
360 if (imm >= -32768 && imm < 32768) { in bpf_jit_build_body()
361 EMIT(PPC_RAW_ADDIC(dst_reg, dst_reg, imm)); in bpf_jit_build_body()
[all …]
Dbpf_jit_comp64.c365 s32 imm = insn[i].imm; in bpf_jit_build_body() local
409 if (!imm) { in bpf_jit_build_body()
411 } else if (imm >= -32768 && imm < 32768) { in bpf_jit_build_body()
412 EMIT(PPC_RAW_ADDI(dst_reg, dst_reg, IMM_L(imm))); in bpf_jit_build_body()
414 PPC_LI32(tmp1_reg, imm); in bpf_jit_build_body()
420 if (!imm) { in bpf_jit_build_body()
422 } else if (imm > -32768 && imm <= 32768) { in bpf_jit_build_body()
423 EMIT(PPC_RAW_ADDI(dst_reg, dst_reg, IMM_L(-imm))); in bpf_jit_build_body()
425 PPC_LI32(tmp1_reg, imm); in bpf_jit_build_body()
438 if (imm >= -32768 && imm < 32768) in bpf_jit_build_body()
[all …]
/linux-6.1.9/arch/arm/net/
Dbpf_jit_32.h164 #define _AL3_I(op, rd, rn, imm) ((op ## _I) | (rd) << 12 | (rn) << 16 | (imm)) argument
170 #define ARM_ADD_I(rd, rn, imm) _AL3_I(ARM_INST_ADD, rd, rn, imm) argument
171 #define ARM_ADDS_I(rd, rn, imm) _AL3_I(ARM_INST_ADDS, rd, rn, imm) argument
173 #define ARM_ADC_I(rd, rn, imm) _AL3_I(ARM_INST_ADC, rd, rn, imm) argument
177 #define ARM_AND_I(rd, rn, imm) _AL3_I(ARM_INST_AND, rd, rn, imm) argument
180 #define ARM_BIC_I(rd, rn, imm) _AL3_I(ARM_INST_BIC, rd, rn, imm) argument
187 #define ARM_CMP_I(rn, imm) _AL3_I(ARM_INST_CMP, 0, rn, imm) argument
190 #define ARM_EOR_I(rd, rn, imm) _AL3_I(ARM_INST_EOR, rd, rn, imm) argument
195 #define ARM_LDR_R_SI(rt, rn, rm, type, imm) \ argument
198 | (imm) << 7 | (type) << 5 | (rm))
[all …]
/linux-6.1.9/tools/include/linux/
Dfilter.h40 .imm = 0 })
48 .imm = 0 })
58 .imm = IMM })
66 .imm = IMM })
76 .imm = LEN })
86 .imm = 0 })
94 .imm = 0 })
104 .imm = IMM })
112 .imm = IMM })
122 .imm = IMM })
[all …]
/linux-6.1.9/arch/mips/net/
Dbpf_jit_comp.c192 void emit_mov_i(struct jit_context *ctx, u8 dst, s32 imm) in emit_mov_i() argument
194 if (imm >= -0x8000 && imm <= 0x7fff) { in emit_mov_i()
195 emit(ctx, addiu, dst, MIPS_R_ZERO, imm); in emit_mov_i()
197 emit(ctx, lui, dst, (s16)((u32)imm >> 16)); in emit_mov_i()
198 emit(ctx, ori, dst, dst, (u16)(imm & 0xffff)); in emit_mov_i()
211 bool valid_alu_i(u8 op, s32 imm) in valid_alu_i() argument
222 return imm >= -0x8000 && imm <= 0x7fff; in valid_alu_i()
225 return imm >= -0x7fff && imm <= 0x8000; in valid_alu_i()
230 return imm >= 0 && imm <= 0xffff; in valid_alu_i()
233 return imm == 0 || (imm > 0 && is_power_of_2(imm)); in valid_alu_i()
[all …]
Dbpf_jit_comp32.c174 static void emit_mov_se_i64(struct jit_context *ctx, const u8 dst[], s32 imm) in emit_mov_se_i64() argument
176 emit_mov_i(ctx, lo(dst), imm); in emit_mov_se_i64()
177 if (imm < 0) in emit_mov_se_i64()
202 const u8 dst[], s32 imm, u8 op) in emit_alu_i64() argument
210 if (imm > S32_MIN && imm < 0) in emit_alu_i64()
214 imm = -imm; in emit_alu_i64()
218 imm = -imm; in emit_alu_i64()
223 emit_mov_i(ctx, src, imm); in emit_alu_i64()
231 if (imm < 0) in emit_alu_i64()
239 if (imm < 0) in emit_alu_i64()
[all …]
Dbpf_jit_comp64.c158 static void emit_alu_i64(struct jit_context *ctx, u8 dst, s32 imm, u8 op) in emit_alu_i64() argument
163 emit(ctx, ori, dst, dst, (u16)imm); in emit_alu_i64()
167 emit(ctx, xori, dst, dst, (u16)imm); in emit_alu_i64()
175 emit(ctx, dsll_safe, dst, dst, imm); in emit_alu_i64()
179 emit(ctx, dsrl_safe, dst, dst, imm); in emit_alu_i64()
183 emit(ctx, dsra_safe, dst, dst, imm); in emit_alu_i64()
187 emit(ctx, daddiu, dst, dst, imm); in emit_alu_i64()
191 emit(ctx, daddiu, dst, dst, -imm); in emit_alu_i64()
195 emit_alu_i(ctx, dst, imm, op); in emit_alu_i64()
639 s32 imm = insn->imm; in build_insn() local
[all …]
Dbpf_jit_comp.h160 void emit_mov_i(struct jit_context *ctx, u8 dst, s32 imm);
166 bool valid_alu_i(u8 op, s32 imm);
169 bool rewrite_alu_i(u8 op, s32 imm, u8 *alu, s32 *val);
172 void emit_alu_i(struct jit_context *ctx, u8 dst, s32 imm, u8 op);
187 bool valid_jmp_i(u8 op, s32 imm);
190 void setup_jmp_i(struct jit_context *ctx, s32 imm, u8 width,
201 void emit_jmp_i(struct jit_context *ctx, u8 dst, s32 imm, s32 off, u8 op);
/linux-6.1.9/samples/bpf/
Dbpf_insn.h16 .imm = 0 })
24 .imm = 0 })
34 .imm = IMM })
42 .imm = IMM })
52 .imm = 0 })
60 .imm = 0 })
70 .imm = IMM })
78 .imm = IMM })
90 .imm = (__u32) (IMM) }), \
96 .imm = ((__u64) (IMM)) >> 32 })
[all …]
/linux-6.1.9/kernel/bpf/
Ddisasm.c23 insn->imm >= 0 && insn->imm < __BPF_FUNC_MAX_ID && in __func_get_name()
24 func_id_str[insn->imm]) in __func_get_name()
25 return func_id_str[insn->imm]; in __func_get_name()
36 snprintf(buff, len, "%+d", insn->imm); in __func_get_name()
128 insn->imm, insn->dst_reg); in print_bpf_end_insn()
161 insn->imm); in print_bpf_insn()
171 (insn->imm == BPF_ADD || insn->imm == BPF_AND || in print_bpf_insn()
172 insn->imm == BPF_OR || insn->imm == BPF_XOR)) { in print_bpf_insn()
177 bpf_alu_string[BPF_OP(insn->imm) >> 4], in print_bpf_insn()
180 (insn->imm == (BPF_ADD | BPF_FETCH) || in print_bpf_insn()
[all …]
/linux-6.1.9/arch/riscv/net/
Dbpf_jit.h263 u32 imm; in rv_j_insn() local
265 imm = (imm20_1 & 0x80000) | ((imm20_1 & 0x3ff) << 9) | in rv_j_insn()
268 return (imm << 12) | (rd << 7) | opcode; in rv_j_insn()
288 u32 imm; in rv_ci_insn() local
290 imm = ((imm6 & 0x20) << 7) | ((imm6 & 0x1f) << 2); in rv_ci_insn()
291 return (funct3 << 13) | (rd << 7) | op | imm; in rv_ci_insn()
326 u32 imm; in rv_cb_insn() local
328 imm = ((imm6 & 0x20) << 7) | ((imm6 & 0x1f) << 2); in rv_cb_insn()
329 return (funct3 << 13) | (funct2 << 10) | ((rd & 0x7) << 7) | op | imm; in rv_cb_insn()
580 u32 imm; in rvc_addi4spn() local
[all …]
Dbpf_jit_comp32.c111 static void emit_imm(const s8 rd, s32 imm, struct rv_jit_context *ctx) in emit_imm() argument
113 u32 upper = (imm + (1 << 11)) >> 12; in emit_imm()
114 u32 lower = imm & 0xfff; in emit_imm()
124 static void emit_imm32(const s8 *rd, s32 imm, struct rv_jit_context *ctx) in emit_imm32() argument
127 emit_imm(lo(rd), imm, ctx); in emit_imm32()
130 if (imm >= 0) in emit_imm32()
243 static void emit_alu_i64(const s8 *dst, s32 imm, in emit_alu_i64() argument
251 emit_imm32(rd, imm, ctx); in emit_alu_i64()
254 if (is_12b_int(imm)) { in emit_alu_i64()
255 emit(rv_andi(lo(rd), lo(rd), imm), ctx); in emit_alu_i64()
[all …]
Dbpf_jit_comp64.c477 static void emit_atomic(u8 rd, u8 rs, s16 off, s32 imm, bool is64, in emit_atomic() argument
493 switch (imm) { in emit_atomic()
634 s32 imm = insn->imm; in bpf_jit_emit_insn() local
642 if (imm == 1) { in bpf_jit_emit_insn()
734 switch (imm) { in bpf_jit_emit_insn()
756 if (imm == 16) in bpf_jit_emit_insn()
768 if (imm == 32) in bpf_jit_emit_insn()
800 emit_imm(rd, imm, ctx); in bpf_jit_emit_insn()
808 if (is_12b_int(imm)) { in bpf_jit_emit_insn()
809 emit_addi(rd, rd, imm, ctx); in bpf_jit_emit_insn()
[all …]
/linux-6.1.9/arch/s390/net/
Dbpf_jit_comp.c180 #define EMIT4_IMM(op, b1, imm) \ argument
182 unsigned int __imm = (imm) & 0xffff; \
240 #define EMIT6_PCREL_RIEC(op1, op2, b1, imm, mask, target) \ argument
244 (rel & 0xffff), (op2) | ((imm) & 0xff) << 8); \
246 BUILD_BUG_ON(((unsigned long) (imm)) > 0xff); \
275 #define _EMIT6_IMM(op, imm) \ argument
277 unsigned int __imm = (imm); \
281 #define EMIT6_IMM(op, b1, imm) \ argument
283 _EMIT6_IMM((op) | reg_high(b1) << 16, imm); \
679 s32 imm = insn->imm; in bpf_jit_insn() local
[all …]
/linux-6.1.9/arch/arm64/net/
Dbpf_jit.h70 #define A64_LS_IMM(Rt, Rn, imm, size, type) \ argument
71 aarch64_insn_gen_load_store_imm(Rt, Rn, imm, \
74 #define A64_STRBI(Wt, Xn, imm) A64_LS_IMM(Wt, Xn, imm, 8, STORE) argument
75 #define A64_LDRBI(Wt, Xn, imm) A64_LS_IMM(Wt, Xn, imm, 8, LOAD) argument
76 #define A64_STRHI(Wt, Xn, imm) A64_LS_IMM(Wt, Xn, imm, 16, STORE) argument
77 #define A64_LDRHI(Wt, Xn, imm) A64_LS_IMM(Wt, Xn, imm, 16, LOAD) argument
78 #define A64_STR32I(Wt, Xn, imm) A64_LS_IMM(Wt, Xn, imm, 32, STORE) argument
79 #define A64_LDR32I(Wt, Xn, imm) A64_LS_IMM(Wt, Xn, imm, 32, LOAD) argument
80 #define A64_STR64I(Xt, Xn, imm) A64_LS_IMM(Xt, Xn, imm, 64, STORE) argument
81 #define A64_LDR64I(Xt, Xn, imm) A64_LS_IMM(Xt, Xn, imm, 64, LOAD) argument
[all …]
Dbpf_jit_comp.c33 #define check_imm(bits, imm) do { \ argument
34 if ((((imm) > 0) && ((imm) >> (bits))) || \
35 (((imm) < 0) && (~(imm) >> (bits)))) { \
37 i, imm, imm); \
41 #define check_imm19(imm) check_imm(19, imm) argument
42 #define check_imm26(imm) check_imm(26, imm) argument
216 static bool is_addsub_imm(u32 imm) in is_addsub_imm() argument
219 return !(imm & ~0xfff) || !(imm & ~0xfff000); in is_addsub_imm()
459 switch (insn->imm) { in emit_lse_atomic()
497 pr_err_once("unknown atomic op code %02x\n", insn->imm); in emit_lse_atomic()
[all …]
/linux-6.1.9/arch/loongarch/net/
Dbpf_jit.h83 static inline void move_imm(struct jit_ctx *ctx, enum loongarch_gpr rd, long imm, bool is32) in move_imm() argument
88 if (imm == 0) { in move_imm()
94 if (is_signed_imm12(imm)) { in move_imm()
95 emit_insn(ctx, addiw, rd, LOONGARCH_GPR_ZERO, imm); in move_imm()
100 if (is_unsigned_imm12(imm)) { in move_imm()
101 emit_insn(ctx, ori, rd, LOONGARCH_GPR_ZERO, imm); in move_imm()
106 imm_63_52 = (imm >> 52) & 0xfff; in move_imm()
107 imm_51_0 = imm & 0xfffffffffffff; in move_imm()
114 imm_31_12 = (imm >> 12) & 0xfffff; in move_imm()
118 imm_11_0 = imm & 0xfff; in move_imm()
[all …]
Dbpf_jit.c286 const s32 imm = insn->imm; in emit_atomic() local
293 switch (imm) { in emit_atomic()
404 const s32 imm = insn->imm; in build_insn() local
405 const u64 imm64 = (u64)(insn + 1)->imm << 32 | (u32)insn->imm; in build_insn()
419 move_imm(ctx, dst, imm, is32); in build_insn()
432 if (is_signed_imm12(imm)) { in build_insn()
433 emit_insn(ctx, addid, dst, dst, imm); in build_insn()
435 move_imm(ctx, t1, imm, is32); in build_insn()
451 if (is_signed_imm12(-imm)) { in build_insn()
452 emit_insn(ctx, addid, dst, dst, -imm); in build_insn()
[all …]
/linux-6.1.9/arch/arm/probes/kprobes/
Dcheckers-common.c34 int imm = insn & 0xff; in checker_stack_use_imm_0xx() local
35 asi->stack_space = imm; in checker_stack_use_imm_0xx()
47 int imm = insn & 0xff; in checker_stack_use_t32strd() local
48 asi->stack_space = imm << 2; in checker_stack_use_t32strd()
56 int imm = ((insn & 0xf00) >> 4) + (insn & 0xf); in checker_stack_use_imm_x0x() local
57 asi->stack_space = imm; in checker_stack_use_imm_x0x()
66 int imm = insn & 0xfff; in checker_stack_use_imm_xxx() local
67 asi->stack_space = imm; in checker_stack_use_imm_xxx()
/linux-6.1.9/arch/arm64/lib/
Dinsn.c198 u32 insn, u64 imm) in aarch64_insn_encode_immediate() argument
209 immlo = (imm & ADR_IMM_LOMASK) << ADR_IMM_LOSHIFT; in aarch64_insn_encode_immediate()
210 imm >>= ADR_IMM_HILOSPLIT; in aarch64_insn_encode_immediate()
211 immhi = (imm & ADR_IMM_HIMASK) << ADR_IMM_HISHIFT; in aarch64_insn_encode_immediate()
212 imm = immlo | immhi; in aarch64_insn_encode_immediate()
226 insn |= (imm & mask) << shift; in aarch64_insn_encode_immediate()
504 unsigned int imm, in aarch64_insn_gen_load_store_imm() argument
517 if (imm & ~(BIT(12 + shift) - BIT(shift))) { in aarch64_insn_gen_load_store_imm()
518 pr_err("%s: invalid imm: %d\n", __func__, imm); in aarch64_insn_gen_load_store_imm()
522 imm >>= shift; in aarch64_insn_gen_load_store_imm()
[all …]
/linux-6.1.9/arch/powerpc/lib/
Dcode-patching.c281 signed long imm; in branch_iform_target() local
283 imm = ppc_inst_val(ppc_inst_read(instr)) & 0x3FFFFFC; in branch_iform_target()
286 if (imm & 0x2000000) in branch_iform_target()
287 imm -= 0x4000000; in branch_iform_target()
290 imm += (unsigned long)instr; in branch_iform_target()
292 return (unsigned long)imm; in branch_iform_target()
297 signed long imm; in branch_bform_target() local
299 imm = ppc_inst_val(ppc_inst_read(instr)) & 0xFFFC; in branch_bform_target()
302 if (imm & 0x8000) in branch_bform_target()
303 imm -= 0x10000; in branch_bform_target()
[all …]
/linux-6.1.9/arch/riscv/kernel/probes/
Dsimulate-insn.c44 u32 imm; in simulate_jal() local
51 imm = ((opcode >> 21) & 0x3ff) << 1; in simulate_jal()
52 imm |= ((opcode >> 20) & 0x1) << 11; in simulate_jal()
53 imm |= ((opcode >> 12) & 0xff) << 12; in simulate_jal()
54 imm |= ((opcode >> 31) & 0x1) << 20; in simulate_jal()
56 instruction_pointer_set(regs, addr + sign_extend32((imm), 20)); in simulate_jal()
70 u32 imm = (opcode >> 20) & 0xfff; in simulate_jalr() local
82 instruction_pointer_set(regs, (base_addr + sign_extend32((imm), 11))&~1); in simulate_jalr()
/linux-6.1.9/arch/sparc/net/
Dbpf_jit_comp_64.c298 static void emit_alu_K(unsigned int opcode, unsigned int dst, unsigned int imm, in emit_alu_K() argument
301 bool small_immed = is_simm13(imm); in emit_alu_K()
306 emit(insn | IMMED | S13(imm), ctx); in emit_alu_K()
312 emit_set_const_sext(imm, tmp, ctx); in emit_alu_K()
317 static void emit_alu3_K(unsigned int opcode, unsigned int src, unsigned int imm, in emit_alu3_K() argument
320 bool small_immed = is_simm13(imm); in emit_alu3_K()
325 emit(insn | IMMED | S13(imm), ctx); in emit_alu3_K()
331 emit_set_const_sext(imm, tmp, ctx); in emit_alu3_K()
636 const u8 dst, s32 imm, struct jit_ctx *ctx) in emit_cbcondi() argument
640 emit(cb_opc | IMMED | WDISP10(off << 2) | RS1(dst) | S5(imm), ctx); in emit_cbcondi()
[all …]
/linux-6.1.9/drivers/net/ethernet/netronome/nfp/bpf/
Djit.c294 emit_immed(struct nfp_prog *nfp_prog, swreg dst, u16 imm, in emit_immed() argument
305 err = swreg_to_unrestricted(dst, dst, reg_imm(imm & 0xff), &reg); in emit_immed()
314 reg.breg, imm >> 8, width, invert, shift, in emit_immed()
590 static bool pack_immed(u32 imm, u16 *val, enum immed_shift *shift) in pack_immed() argument
592 if (!(imm & 0xffff0000)) { in pack_immed()
593 *val = imm; in pack_immed()
595 } else if (!(imm & 0xff0000ff)) { in pack_immed()
596 *val = imm >> 8; in pack_immed()
598 } else if (!(imm & 0x0000ffff)) { in pack_immed()
599 *val = imm >> 16; in pack_immed()
[all …]
/linux-6.1.9/arch/sh/kernel/
Ddisassemble.c300 int imm = 0; in print_sh_insn() local
317 imm = (nibs[2] << 4) | (nibs[3]); in print_sh_insn()
318 if (imm & 0x80) in print_sh_insn()
319 imm |= ~0xff; in print_sh_insn()
320 imm = ((char)imm) * 2 + 4 ; in print_sh_insn()
323 imm = ((nibs[1]) << 8) | (nibs[2] << 4) | (nibs[3]); in print_sh_insn()
324 if (imm & 0x800) in print_sh_insn()
325 imm |= ~0xfff; in print_sh_insn()
326 imm = imm * 2 + 4; in print_sh_insn()
329 imm = nibs[3]; in print_sh_insn()
[all …]

123456