arm32, bpf: add support for 32-bit offset jmp instruction
The cpuv4 adds unconditional jump with 32-bit offset where the immediate field of the instruction is to be used to calculate the jump offset. BPF_JA | BPF_K | BPF_JMP32 => gotol +imm => PC += imm. Signed-off-by: Puranjay Mohan <puranjay12@gmail.com> Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://lore.kernel.org/r/20230907230550.1417590-2-puranjay12@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
9b2b86332a
commit
471f3d4ee4
@ -1761,10 +1761,15 @@ go_jmp:
|
||||
break;
|
||||
/* JMP OFF */
|
||||
case BPF_JMP | BPF_JA:
|
||||
case BPF_JMP32 | BPF_JA:
|
||||
{
|
||||
if (off == 0)
|
||||
if (BPF_CLASS(code) == BPF_JMP32 && imm != 0)
|
||||
jmp_offset = bpf2a32_offset(i + imm, i, ctx);
|
||||
else if (BPF_CLASS(code) == BPF_JMP && off != 0)
|
||||
jmp_offset = bpf2a32_offset(i + off, i, ctx);
|
||||
else
|
||||
break;
|
||||
jmp_offset = bpf2a32_offset(i+off, i, ctx);
|
||||
|
||||
check_imm24(jmp_offset);
|
||||
emit(ARM_B(jmp_offset), ctx);
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user