From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiong Wang Subject: [PATH bpf-next 06/13] arm64: bpf: implement jitting of JMP32 Date: Wed, 19 Dec 2018 17:44:13 -0500 Message-ID: <1545259460-13376-7-git-send-email-jiong.wang@netronome.com> References: <1545259460-13376-1-git-send-email-jiong.wang@netronome.com> Cc: netdev@vger.kernel.org, oss-drivers@netronome.com, Jiong Wang , Zi Shen Lim To: ast@kernel.org, daniel@iogearbox.net Return-path: Received: from mail-wm1-f43.google.com ([209.85.128.43]:36109 "EHLO mail-wm1-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729214AbeLSWon (ORCPT ); Wed, 19 Dec 2018 17:44:43 -0500 Received: by mail-wm1-f43.google.com with SMTP id p6so107990wmc.1 for ; Wed, 19 Dec 2018 14:44:41 -0800 (PST) In-Reply-To: <1545259460-13376-1-git-send-email-jiong.wang@netronome.com> Sender: netdev-owner@vger.kernel.org List-ID: This patch implements code-gen for new JMP32 instructions on arm64. Cc: Daniel Borkmann Cc: Alexei Starovoitov Cc: Zi Shen Lim Signed-off-by: Jiong Wang --- arch/arm64/net/bpf_jit_comp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index 1542df0..9ed73af 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -559,7 +559,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, case BPF_JMP | BPF_JSLT | BPF_X: case BPF_JMP | BPF_JSGE | BPF_X: case BPF_JMP | BPF_JSLE | BPF_X: - emit(A64_CMP(1, dst, src), ctx); + emit(A64_CMP(!!imm, dst, src), ctx); emit_cond_jmp: jmp_offset = bpf2a64_offset(i + off, i, ctx); check_imm19(jmp_offset); @@ -614,9 +614,13 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, case BPF_JMP | BPF_JSLT | BPF_K: case BPF_JMP | BPF_JSGE | BPF_K: case BPF_JMP | BPF_JSLE | BPF_K: - emit_a64_mov_i(1, tmp, imm, ctx); - emit(A64_CMP(1, dst, tmp), ctx); + { + bool is_jmp32 = !!insn->src_reg; + + emit_a64_mov_i(is_jmp32, tmp, imm, ctx); + emit(A64_CMP(is_jmp32, dst, tmp), ctx); goto emit_cond_jmp; + } case BPF_JMP | BPF_JSET | BPF_K: emit_a64_mov_i(1, tmp, imm, ctx); emit(A64_TST(1, dst, tmp), ctx); -- 2.7.4