Skip to content

Commit d9839f1

Browse files
Pu LehuiAlexei Starovoitov
authored andcommitted
riscv, bpf: Support 32-bit offset jmp insn
Add support 32-bit offset jmp instruction for RV64. Signed-off-by: Pu Lehui <pulehui@huawei.com> Acked-by: Björn Töpel <bjorn@kernel.org> Link: https://lore.kernel.org/r/20230824095001.3408573-5-pulehui@huaweicloud.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 694896a commit d9839f1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arch/riscv/net/bpf_jit_comp64.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1327,7 +1327,11 @@ int bpf_jit_emit_insn(const struct bpf_insn *insn, struct rv_jit_context *ctx,
13271327

13281328
/* JUMP off */
13291329
case BPF_JMP | BPF_JA:
1330-
rvoff = rv_offset(i, off, ctx);
1330+
case BPF_JMP32 | BPF_JA:
1331+
if (BPF_CLASS(code) == BPF_JMP)
1332+
rvoff = rv_offset(i, off, ctx);
1333+
else
1334+
rvoff = rv_offset(i, imm, ctx);
13311335
ret = emit_jump_and_link(RV_REG_ZERO, rvoff, true, ctx);
13321336
if (ret)
13331337
return ret;

0 commit comments

Comments
 (0)