Skip to content

Commit 83cc63a

Browse files
Pu LehuiAlexei Starovoitov
authored andcommitted
riscv, bpf: Support unconditional bswap insn
Add support unconditional bswap instruction. Since riscv is always little-endian, just treat the unconditional scenario the same as big-endian conversion. Signed-off-by: Pu Lehui <pulehui@huawei.com> Acked-by: Björn Töpel <bjorn@kernel.org> Link: https://lore.kernel.org/r/20230824095001.3408573-7-pulehui@huaweicloud.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 3e18ff4 commit 83cc63a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/riscv/net/bpf_jit_comp64.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,7 @@ int bpf_jit_emit_insn(const struct bpf_insn *insn, struct rv_jit_context *ctx,
11681168
break;
11691169

11701170
case BPF_ALU | BPF_END | BPF_FROM_BE:
1171+
case BPF_ALU64 | BPF_END | BPF_FROM_LE:
11711172
emit_li(RV_REG_T2, 0, ctx);
11721173

11731174
emit_andi(RV_REG_T1, rd, 0xff, ctx);

0 commit comments

Comments
 (0)