Lines Matching defs:rvoff
210 static void emit_bcc(u8 cond, u8 rd, u8 rs, int rvoff,
215 emit(rv_beq(rd, rs, rvoff >> 1), ctx);
218 emit(rv_bltu(rs, rd, rvoff >> 1), ctx);
221 emit(rv_bltu(rd, rs, rvoff >> 1), ctx);
224 emit(rv_bgeu(rd, rs, rvoff >> 1), ctx);
227 emit(rv_bgeu(rs, rd, rvoff >> 1), ctx);
230 emit(rv_bne(rd, rs, rvoff >> 1), ctx);
233 emit(rv_blt(rs, rd, rvoff >> 1), ctx);
236 emit(rv_blt(rd, rs, rvoff >> 1), ctx);
239 emit(rv_bge(rd, rs, rvoff >> 1), ctx);
242 emit(rv_bge(rs, rd, rvoff >> 1), ctx);
246 static void emit_branch(u8 cond, u8 rd, u8 rs, int rvoff,
251 if (is_13b_int(rvoff)) {
252 emit_bcc(cond, rd, rs, rvoff, ctx);
257 rvoff -= 4;
268 if (is_21b_int(rvoff)) {
270 emit(rv_jal(RV_REG_ZERO, rvoff >> 1), ctx);
274 /* 32b No need for an additional rvoff adjustment, since we
277 upper = (rvoff + (1 << 11)) >> 12;
278 lower = rvoff & 0xfff;
397 static int emit_jump_and_link(u8 rd, s64 rvoff, bool fixed_addr,
402 if (rvoff && fixed_addr && is_21b_int(rvoff)) {
403 emit(rv_jal(rd, rvoff >> 1), ctx);
405 } else if (in_auipc_jalr_range(rvoff)) {
406 upper = (rvoff + (1 << 11)) >> 12;
407 lower = rvoff & 0xfff;
413 pr_err("bpf-jit: target offset 0x%llx is out of range\n", rvoff);
441 int s, e, rvoff, ret, i = insn - ctx->prog->insnsi;
726 rvoff = rv_offset(i, off, ctx);
727 ret = emit_jump_and_link(RV_REG_ZERO, rvoff, true, ctx);
755 rvoff = rv_offset(i, off, ctx);
765 rvoff -= ninsns_rvoff(e - s);
770 rvoff -= 4;
772 emit_branch(BPF_JNE, RV_REG_T1, RV_REG_ZERO, rvoff,
775 emit_branch(BPF_OP(code), rd, rs, rvoff, ctx);
800 rvoff = rv_offset(i, off, ctx);
818 rvoff -= ninsns_rvoff(e - s);
819 emit_branch(BPF_OP(code), rd, rs, rvoff, ctx);
824 rvoff = rv_offset(i, off, ctx);
839 rvoff -= ninsns_rvoff(e - s);
840 emit_branch(BPF_JNE, RV_REG_T1, RV_REG_ZERO, rvoff, ctx);
874 rvoff = epilogue_offset(ctx);
875 ret = emit_jump_and_link(RV_REG_ZERO, rvoff, true, ctx);