aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm64/net/bpf_jit.h8
-rw-r--r--arch/arm64/net/bpf_jit_comp.c12
2 files changed, 18 insertions, 2 deletions
diff --git a/arch/arm64/net/bpf_jit.h b/arch/arm64/net/bpf_jit.h
index 2134f7e6c288..de0a81a539a0 100644
--- a/arch/arm64/net/bpf_jit.h
+++ b/arch/arm64/net/bpf_jit.h
@@ -144,8 +144,12 @@
144 144
145/* Data-processing (2 source) */ 145/* Data-processing (2 source) */
146/* Rd = Rn OP Rm */ 146/* Rd = Rn OP Rm */
147#define A64_UDIV(sf, Rd, Rn, Rm) aarch64_insn_gen_data2(Rd, Rn, Rm, \ 147#define A64_DATA2(sf, Rd, Rn, Rm, type) aarch64_insn_gen_data2(Rd, Rn, Rm, \
148 A64_VARIANT(sf), AARCH64_INSN_DATA2_UDIV) 148 A64_VARIANT(sf), AARCH64_INSN_DATA2_##type)
149#define A64_UDIV(sf, Rd, Rn, Rm) A64_DATA2(sf, Rd, Rn, Rm, UDIV)
150#define A64_LSLV(sf, Rd, Rn, Rm) A64_DATA2(sf, Rd, Rn, Rm, LSLV)
151#define A64_LSRV(sf, Rd, Rn, Rm) A64_DATA2(sf, Rd, Rn, Rm, LSRV)
152#define A64_ASRV(sf, Rd, Rn, Rm) A64_DATA2(sf, Rd, Rn, Rm, ASRV)
149 153
150/* Data-processing (3 source) */ 154/* Data-processing (3 source) */
151/* Rd = Ra + Rn * Rm */ 155/* Rd = Ra + Rn * Rm */
diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
index 71088952ed27..80cc76972798 100644
--- a/arch/arm64/net/bpf_jit_comp.c
+++ b/arch/arm64/net/bpf_jit_comp.c
@@ -261,6 +261,18 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx)
261 emit(A64_MUL(is64, tmp, tmp, src), ctx); 261 emit(A64_MUL(is64, tmp, tmp, src), ctx);
262 emit(A64_SUB(is64, dst, dst, tmp), ctx); 262 emit(A64_SUB(is64, dst, dst, tmp), ctx);
263 break; 263 break;
264 case BPF_ALU | BPF_LSH | BPF_X:
265 case BPF_ALU64 | BPF_LSH | BPF_X:
266 emit(A64_LSLV(is64, dst, dst, src), ctx);
267 break;
268 case BPF_ALU | BPF_RSH | BPF_X:
269 case BPF_ALU64 | BPF_RSH | BPF_X:
270 emit(A64_LSRV(is64, dst, dst, src), ctx);
271 break;
272 case BPF_ALU | BPF_ARSH | BPF_X:
273 case BPF_ALU64 | BPF_ARSH | BPF_X:
274 emit(A64_ASRV(is64, dst, dst, src), ctx);
275 break;
264 /* dst = -dst */ 276 /* dst = -dst */
265 case BPF_ALU | BPF_NEG: 277 case BPF_ALU | BPF_NEG:
266 case BPF_ALU64 | BPF_NEG: 278 case BPF_ALU64 | BPF_NEG: