Lines Matching refs:rvoff
280 static void emit_bcc(u8 cond, u8 rd, u8 rs, int rvoff, in emit_bcc() argument
285 emit(rv_beq(rd, rs, rvoff >> 1), ctx); in emit_bcc()
288 emit(rv_bltu(rs, rd, rvoff >> 1), ctx); in emit_bcc()
291 emit(rv_bltu(rd, rs, rvoff >> 1), ctx); in emit_bcc()
294 emit(rv_bgeu(rd, rs, rvoff >> 1), ctx); in emit_bcc()
297 emit(rv_bgeu(rs, rd, rvoff >> 1), ctx); in emit_bcc()
300 emit(rv_bne(rd, rs, rvoff >> 1), ctx); in emit_bcc()
303 emit(rv_blt(rs, rd, rvoff >> 1), ctx); in emit_bcc()
306 emit(rv_blt(rd, rs, rvoff >> 1), ctx); in emit_bcc()
309 emit(rv_bge(rd, rs, rvoff >> 1), ctx); in emit_bcc()
312 emit(rv_bge(rs, rd, rvoff >> 1), ctx); in emit_bcc()
316 static void emit_branch(u8 cond, u8 rd, u8 rs, int rvoff, in emit_branch() argument
321 if (is_13b_int(rvoff)) { in emit_branch()
322 emit_bcc(cond, rd, rs, rvoff, ctx); in emit_branch()
327 rvoff -= 4; in emit_branch()
338 if (is_21b_int(rvoff)) { in emit_branch()
340 emit(rv_jal(RV_REG_ZERO, rvoff >> 1), ctx); in emit_branch()
347 upper = (rvoff + (1 << 11)) >> 12; in emit_branch()
348 lower = rvoff & 0xfff; in emit_branch()
427 static int emit_jump_and_link(u8 rd, s64 rvoff, bool fixed_addr, in emit_jump_and_link() argument
432 if (rvoff && fixed_addr && is_21b_int(rvoff)) { in emit_jump_and_link()
433 emit(rv_jal(rd, rvoff >> 1), ctx); in emit_jump_and_link()
435 } else if (in_auipc_jalr_range(rvoff)) { in emit_jump_and_link()
436 upper = (rvoff + (1 << 11)) >> 12; in emit_jump_and_link()
437 lower = rvoff & 0xfff; in emit_jump_and_link()
443 pr_err("bpf-jit: target offset 0x%llx is out of range\n", rvoff); in emit_jump_and_link()
651 s64 rvoff; in gen_jump_or_nops() local
663 rvoff = (s64)(target - ip); in gen_jump_or_nops()
664 return emit_jump_and_link(is_call ? RV_REG_T0 : RV_REG_ZERO, rvoff, false, &ctx); in gen_jump_or_nops()
1128 int s, e, rvoff, ret, i = insn - ctx->prog->insnsi; in bpf_jit_emit_insn() local
1422 rvoff = rv_offset(i, off, ctx); in bpf_jit_emit_insn()
1424 rvoff = rv_offset(i, imm, ctx); in bpf_jit_emit_insn()
1425 ret = emit_jump_and_link(RV_REG_ZERO, rvoff, true, ctx); in bpf_jit_emit_insn()
1453 rvoff = rv_offset(i, off, ctx); in bpf_jit_emit_insn()
1466 rvoff -= ninsns_rvoff(e - s); in bpf_jit_emit_insn()
1471 rvoff -= 4; in bpf_jit_emit_insn()
1473 emit_branch(BPF_JNE, RV_REG_T1, RV_REG_ZERO, rvoff, ctx); in bpf_jit_emit_insn()
1475 emit_branch(BPF_OP(code), rd, rs, rvoff, ctx); in bpf_jit_emit_insn()
1500 rvoff = rv_offset(i, off, ctx); in bpf_jit_emit_insn()
1518 rvoff -= ninsns_rvoff(e - s); in bpf_jit_emit_insn()
1519 emit_branch(BPF_OP(code), rd, rs, rvoff, ctx); in bpf_jit_emit_insn()
1524 rvoff = rv_offset(i, off, ctx); in bpf_jit_emit_insn()
1539 rvoff -= ninsns_rvoff(e - s); in bpf_jit_emit_insn()
1540 emit_branch(BPF_JNE, RV_REG_T1, RV_REG_ZERO, rvoff, ctx); in bpf_jit_emit_insn()
1606 rvoff = epilogue_offset(ctx); in bpf_jit_emit_insn()
1607 ret = emit_jump_and_link(RV_REG_ZERO, rvoff, true, ctx); in bpf_jit_emit_insn()