mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 05:12:49 +00:00
LoongArch: BPF: Support 32-bit offset jmp instructions
Add support for 32-bit offset jmp instruction. Currently, we use b instruction which supports range within ±128MB for such jumps. This should be large enough for BPF progs. Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
This commit is contained in:
parent
4ebf9216e7
commit
9ddd2b8d1a
1 changed files with 5 additions and 1 deletions
|
@ -848,7 +848,11 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext
|
|||
|
||||
/* PC += off */
|
||||
case BPF_JMP | BPF_JA:
|
||||
jmp_offset = bpf2la_offset(i, off, ctx);
|
||||
case BPF_JMP32 | BPF_JA:
|
||||
if (BPF_CLASS(code) == BPF_JMP)
|
||||
jmp_offset = bpf2la_offset(i, off, ctx);
|
||||
else
|
||||
jmp_offset = bpf2la_offset(i, imm, ctx);
|
||||
if (emit_uncond_jmp(ctx, jmp_offset) < 0)
|
||||
goto toofar;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue