aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/net/ebpf_jit.c
diff options
context:
space:
mode:
authorJiong Wang <jiong.wang@netronome.com>2018-12-05 13:52:30 -0500
committerAlexei Starovoitov <ast@kernel.org>2018-12-07 13:30:48 -0800
commitee94b90c8acaa593b627f5f3fe93e076e7779f5c (patch)
tree4448eaaafbb857abc286215b121f37ed7656aefb /arch/mips/net/ebpf_jit.c
parentmips: bpf: fix encoding bug for mm_srlv32_op (diff)
downloadlinux-dev-ee94b90c8acaa593b627f5f3fe93e076e7779f5c.tar.xz
linux-dev-ee94b90c8acaa593b627f5f3fe93e076e7779f5c.zip
mips: bpf: implement jitting of BPF_ALU | BPF_ARSH | BPF_X
Jitting of BPF_K is supported already, but not BPF_X. This patch complete the support for the latter on both MIPS and microMIPS. Cc: Paul Burton <paul.burton@mips.com> Cc: linux-mips@vger.kernel.org Acked-by: Paul Burton <paul.burton@mips.com> Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to '')
-rw-r--r--arch/mips/net/ebpf_jit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/mips/net/ebpf_jit.c b/arch/mips/net/ebpf_jit.c
index aeb7b1b0f202..b16710a8a9e7 100644
--- a/arch/mips/net/ebpf_jit.c
+++ b/arch/mips/net/ebpf_jit.c
@@ -854,6 +854,7 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
case BPF_ALU | BPF_MOD | BPF_X: /* ALU_REG */
case BPF_ALU | BPF_LSH | BPF_X: /* ALU_REG */
case BPF_ALU | BPF_RSH | BPF_X: /* ALU_REG */
+ case BPF_ALU | BPF_ARSH | BPF_X: /* ALU_REG */
src = ebpf_to_mips_reg(ctx, insn, src_reg_no_fp);
dst = ebpf_to_mips_reg(ctx, insn, dst_reg);
if (src < 0 || dst < 0)
@@ -913,6 +914,9 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
case BPF_RSH:
emit_instr(ctx, srlv, dst, dst, src);
break;
+ case BPF_ARSH:
+ emit_instr(ctx, srav, dst, dst, src);
+ break;
default:
pr_err("ALU_REG NOT HANDLED\n");
return -EINVAL;