bpf, arm64: Support unconditional bswap
Add JIT support for unconditional bswap instructions. Signed-off-by: Xu Kuohai <xukuohai@huawei.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Tested-by: Florent Revest <revest@chromium.org> Acked-by: Florent Revest <revest@chromium.org> Link: https://lore.kernel.org/bpf/20230815154158.717901-5-xukuohai@huaweicloud.com
This commit is contained in:
parent
bb0a1d6b49
commit
1104247f3f
1 changed files with 3 additions and 2 deletions
|
@ -855,11 +855,12 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
|
||||||
/* dst = BSWAP##imm(dst) */
|
/* dst = BSWAP##imm(dst) */
|
||||||
case BPF_ALU | BPF_END | BPF_FROM_LE:
|
case BPF_ALU | BPF_END | BPF_FROM_LE:
|
||||||
case BPF_ALU | BPF_END | BPF_FROM_BE:
|
case BPF_ALU | BPF_END | BPF_FROM_BE:
|
||||||
|
case BPF_ALU64 | BPF_END | BPF_FROM_LE:
|
||||||
#ifdef CONFIG_CPU_BIG_ENDIAN
|
#ifdef CONFIG_CPU_BIG_ENDIAN
|
||||||
if (BPF_SRC(code) == BPF_FROM_BE)
|
if (BPF_CLASS(code) == BPF_ALU && BPF_SRC(code) == BPF_FROM_BE)
|
||||||
goto emit_bswap_uxt;
|
goto emit_bswap_uxt;
|
||||||
#else /* !CONFIG_CPU_BIG_ENDIAN */
|
#else /* !CONFIG_CPU_BIG_ENDIAN */
|
||||||
if (BPF_SRC(code) == BPF_FROM_LE)
|
if (BPF_CLASS(code) == BPF_ALU && BPF_SRC(code) == BPF_FROM_LE)
|
||||||
goto emit_bswap_uxt;
|
goto emit_bswap_uxt;
|
||||||
#endif
|
#endif
|
||||||
switch (imm) {
|
switch (imm) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue