Skip to content

Commit 1104247

Browse files
Xu Kuohaiborkmann
Xu Kuohai
authored andcommitted
bpf, arm64: Support unconditional bswap
Add JIT support for unconditional bswap instructions. Signed-off-by: Xu Kuohai <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Tested-by: Florent Revest <[email protected]> Acked-by: Florent Revest <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent bb0a1d6 commit 1104247

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/arm64/net/bpf_jit_comp.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -855,11 +855,12 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
855855
/* dst = BSWAP##imm(dst) */
856856
case BPF_ALU | BPF_END | BPF_FROM_LE:
857857
case BPF_ALU | BPF_END | BPF_FROM_BE:
858+
case BPF_ALU64 | BPF_END | BPF_FROM_LE:
858859
#ifdef CONFIG_CPU_BIG_ENDIAN
859-
if (BPF_SRC(code) == BPF_FROM_BE)
860+
if (BPF_CLASS(code) == BPF_ALU && BPF_SRC(code) == BPF_FROM_BE)
860861
goto emit_bswap_uxt;
861862
#else /* !CONFIG_CPU_BIG_ENDIAN */
862-
if (BPF_SRC(code) == BPF_FROM_LE)
863+
if (BPF_CLASS(code) == BPF_ALU && BPF_SRC(code) == BPF_FROM_LE)
863864
goto emit_bswap_uxt;
864865
#endif
865866
switch (imm) {

0 commit comments

Comments
 (0)