From patchwork Tue Nov 10 22:41:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 56354 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1044099lbb; Tue, 10 Nov 2015 15:00:59 -0800 (PST) X-Received: by 10.68.91.228 with SMTP id ch4mr9391285pbb.41.1447196458859; Tue, 10 Nov 2015 15:00:58 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k8si7981013pbq.49.2015.11.10.15.00.58; Tue, 10 Nov 2015 15:00:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752200AbbKJXA5 (ORCPT + 28 others); Tue, 10 Nov 2015 18:00:57 -0500 Received: from mail-pa0-f52.google.com ([209.85.220.52]:35267 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751695AbbKJXAW (ORCPT ); Tue, 10 Nov 2015 18:00:22 -0500 Received: by pasz6 with SMTP id z6so10945917pas.2 for ; Tue, 10 Nov 2015 15:00:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LxxOLTEFSExeYixZYFW9vwwvihNdl5MGLdtg1RymEgw=; b=AzmCgcYKzvvazxXTko1S+StQsZEexlrPpxMN/lQBNlW76GB7pmQ4TEzUv8dOOsX99S ssqqi6QvzexZ4xK9yhO22vZ7vSQ79NFxpugxkSPQ7619sBbj0xCO/v4VvHpL+j9f/qxk +z+p5esTuY62vZ+5fJiN6p0+T9k4ZHqERXGMRKVhKvXw6DBDZms44U9ZF/3lKnVV9B6m P4r7k+oAETQ6bqc818dxyWpD3pH9yRwPfsobGNqvlbB7pcVhC25i4J880Hfm1E1N+Uhk RogpWeB4Uo4mfKpn0hdEYS6jj4+uYJlYsF21EJBc9LqETebWJ8I1GEUOa8QlhQbM+j6r vimQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LxxOLTEFSExeYixZYFW9vwwvihNdl5MGLdtg1RymEgw=; b=IGSyBGNwCtcqxgUYHy+dOjZIsG8fLhvwrsSenxSmkl16tCdUQdH8kYZ+g708TNfIJE eBGLMrUh9/pZ7rV1uWTJA2kZ/q09m4Pw+iHkHeg6FMFsMW1n9io1JiNlnM2E+KQJrQET KJDclkVxVHOfCVv1GJGCH6oOpsz4Jtsoq5vFegmFNbJyGP3kXJ5R65t4vscJeySbfney V4LzYMAMcABUwgGpecIX3KdJBvNeI1blozriY8OfzYJV9gW7FUCy89aKx79QVr9dJ11X fprWsC1KyfBbkM+XAN+aYs8EoaHN4BpGS/1ro2mxTbpoBN1K823uy1Ai/4VooUY6i6zz pXjg== X-Gm-Message-State: ALoCoQm4hU6yKlaKqZlVWDAMaaYC1H14cRgh3LnUyLFuoytx5o5f7iSbvE4zMuyrfz3gZ88I6MjN X-Received: by 10.68.203.132 with SMTP id kq4mr9604241pbc.82.1447196422268; Tue, 10 Nov 2015 15:00:22 -0800 (PST) Received: from yshi-Precision-T5600.corp.ad.wrs.com (unknown-216-82.windriver.com. [147.11.216.82]) by smtp.gmail.com with ESMTPSA id c5sm6102743pbu.18.2015.11.10.15.00.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Nov 2015 15:00:21 -0800 (PST) From: Yang Shi To: ast@kernel.org, daniel@iogearbox.net, catalin.marinas@arm.com, will.deacon@arm.com Cc: zlim.lnx@gmail.com, xi.wang@gmail.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, yang.shi@linaro.org Subject: [PATCH 1/2] arm64: bpf: add 'store immediate' instruction Date: Tue, 10 Nov 2015 14:41:40 -0800 Message-Id: <1447195301-16757-2-git-send-email-yang.shi@linaro.org> X-Mailer: git-send-email 2.0.2 In-Reply-To: <1447195301-16757-1-git-send-email-yang.shi@linaro.org> References: <1447195301-16757-1-git-send-email-yang.shi@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org aarch64 doesn't have native store immediate instruction, such operation has to be implemented by the below instruction sequence: Load immediate to register Store register Signed-off-by: Yang Shi CC: Zi Shen Lim CC: Xi Wang --- arch/arm64/net/bpf_jit_comp.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) -- 2.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ Reviewed-by: Zi Shen Lim diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index 6809647..49c1f1b 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -563,7 +563,25 @@ emit_cond_jmp: case BPF_ST | BPF_MEM | BPF_H: case BPF_ST | BPF_MEM | BPF_B: case BPF_ST | BPF_MEM | BPF_DW: - goto notyet; + /* Load imm to a register then store it */ + ctx->tmp_used = 1; + emit_a64_mov_i(1, tmp2, off, ctx); + emit_a64_mov_i(1, tmp, imm, ctx); + switch (BPF_SIZE(code)) { + case BPF_W: + emit(A64_STR32(tmp, dst, tmp2), ctx); + break; + case BPF_H: + emit(A64_STRH(tmp, dst, tmp2), ctx); + break; + case BPF_B: + emit(A64_STRB(tmp, dst, tmp2), ctx); + break; + case BPF_DW: + emit(A64_STR64(tmp, dst, tmp2), ctx); + break; + } + break; /* STX: *(size *)(dst + off) = src */ case BPF_STX | BPF_MEM | BPF_W: