From patchwork Wed Jul 24 14:48:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 2832878 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 365169F4E2 for ; Wed, 24 Jul 2013 14:53:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 051F5203FF for ; Wed, 24 Jul 2013 14:53:44 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9B39B2039A for ; Wed, 24 Jul 2013 14:53:42 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V20Rc-00045f-W0; Wed, 24 Jul 2013 14:53:37 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V20Ml-00066j-9X; Wed, 24 Jul 2013 14:48:35 +0000 Received: from ducie-dc1.codethink.co.uk ([37.128.190.40]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V20Mi-000660-58 for linux-arm-kernel@lists.infradead.org; Wed, 24 Jul 2013 14:48:33 +0000 Received: from localhost (localhost [127.0.0.1]) by ducie-dc1.codethink.co.uk (Postfix) with ESMTP id CD3F4462DD8; Wed, 24 Jul 2013 15:48:10 +0100 (BST) X-Virus-Scanned: Debian amavisd-new at ducie-dc1.codethink.co.uk Received: from ducie-dc1.codethink.co.uk ([127.0.0.1]) by localhost (ducie-dc1.codethink.co.uk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xnjrp4+A5APp; Wed, 24 Jul 2013 15:48:08 +0100 (BST) Received: from [192.168.24.134] (rainbowdash.dyn.ducie.codethink.co.uk [192.168.24.134]) by ducie-dc1.codethink.co.uk (Postfix) with ESMTPSA id 7E9C2461A26; Wed, 24 Jul 2013 15:48:08 +0100 (BST) Message-ID: <51EFE928.2070907@codethink.co.uk> Date: Wed, 24 Jul 2013 15:48:08 +0100 From: Ben Dooks Organization: Codethink Limited. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: Will Deacon Subject: Re: [PATCH 02/14] ARM: asm: Add ARM_BE8() assembly helper References: <1374661682-9349-1-git-send-email-ben.dooks@codethink.co.uk> <1374661682-9349-3-git-send-email-ben.dooks@codethink.co.uk> <20130724142825.GK11072@mudshark.cambridge.arm.com> In-Reply-To: <20130724142825.GK11072@mudshark.cambridge.arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130724_104832_331113_44E12F9B X-CRM114-Status: GOOD ( 15.40 ) X-Spam-Score: -1.9 (-) Cc: "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 24/07/13 15:28, Will Deacon wrote: > On Wed, Jul 24, 2013 at 11:27:50AM +0100, Ben Dooks wrote: >> Add ARM_BE8() helper to wrap any code conditional on being >> compile when CONFIG_ARM_ENDIAN_BE8 is selected and convert >> existing places where this is to use it. >> >> Acked-by: Nicolas Pitre >> Signed-off-by: Ben Dooks > > Reviewed-by: Will Deacon > > We could probably add a similar ARM_LE helper to clean up the > __LITTLE_ENDIAN definitions in arch/arm/net/bpf_jit_32.c too. > > Will I did however realise we need to fix the instruction storage so changed _emit to fix this as follows: ARM: net: fix arm instruction endian-ness in bpf_jit_32.c Use to correctly transform instruction byte ordering into in-memory ordering. Signed-off-by: Ben Dooks diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c index 1a643ee..95b43b6 100644 --- a/arch/arm/net/bpf_jit_32.c +++ b/arch/arm/net/bpf_jit_32.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "bpf_jit_32.h" @@ -113,8 +114,11 @@ static u32 jit_udiv(u32 dividend, u32 divisor) static inline void _emit(int cond, u32 inst, struct jit_ctx *ctx) { + inst |= (cond << 28); + inst = __opcode_to_mem_arm(inst); + if (ctx->target != NULL) - ctx->target[ctx->idx] = inst | (cond << 28); + ctx->target[ctx->idx] = inst; ctx->idx++; }