mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
bpf, mips: Add JIT support for JMP32_JA
The JMP32_JA instruction from the eBPF v4 ISA was not implemented. This caused programs using the instruction to fall back to the interpreter. Implement the JMP32_JA instruction. Signed-off-by: Johan Almbladh <johan.almbladh@anyfinetworks.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20260925231932.1063678-3-johan.almbladh@anyfinetworks.com
This commit is contained in:
parent
89d8e19811
commit
f4f496deca
|
|
@ -850,7 +850,7 @@ void emit_jmp_r(struct jit_context *ctx, u8 dst, u8 src, s32 off, u8 op)
|
|||
}
|
||||
|
||||
/* Jump always */
|
||||
int emit_ja(struct jit_context *ctx, s16 off)
|
||||
int emit_ja(struct jit_context *ctx, s32 off)
|
||||
{
|
||||
int target = get_target(ctx, ctx->bpf_index + off + 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ void emit_jmp_i(struct jit_context *ctx, u8 dst, s32 imm, s32 off, u8 op);
|
|||
void emit_jmp_r(struct jit_context *ctx, u8 dst, u8 src, s32 off, u8 op);
|
||||
|
||||
/* Jump always */
|
||||
int emit_ja(struct jit_context *ctx, s16 off);
|
||||
int emit_ja(struct jit_context *ctx, s32 off);
|
||||
|
||||
/* Jump to epilogue */
|
||||
int emit_exit(struct jit_context *ctx);
|
||||
|
|
|
|||
|
|
@ -1877,6 +1877,13 @@ int build_insn(const struct bpf_insn *insn, struct jit_context *ctx)
|
|||
if (finish_jmp(ctx, jmp, off) < 0)
|
||||
goto toofar;
|
||||
break;
|
||||
/* PC += imm */
|
||||
case BPF_JMP32 | BPF_JA:
|
||||
if (imm == 0)
|
||||
break;
|
||||
if (emit_ja(ctx, imm) < 0)
|
||||
goto toofar;
|
||||
break;
|
||||
/* PC += off if dst == src */
|
||||
/* PC += off if dst != src */
|
||||
/* PC += off if dst & src */
|
||||
|
|
|
|||
|
|
@ -1041,6 +1041,13 @@ int build_insn(const struct bpf_insn *insn, struct jit_context *ctx)
|
|||
if (finish_jmp(ctx, jmp, off) < 0)
|
||||
goto toofar;
|
||||
break;
|
||||
/* PC += imm */
|
||||
case BPF_JMP32 | BPF_JA:
|
||||
if (imm == 0)
|
||||
break;
|
||||
if (emit_ja(ctx, imm) < 0)
|
||||
goto toofar;
|
||||
break;
|
||||
/* PC += off if dst == src */
|
||||
/* PC += off if dst != src */
|
||||
/* PC += off if dst & src */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user