From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1660FC4361B for ; Wed, 9 Dec 2020 10:39:46 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BA99C23B79 for ; Wed, 9 Dec 2020 10:39:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA99C23B79 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eV4+VD/ZDggbB8rX4adaWkM4ZjnJ8yO/TItnKmt3l2I=; b=RIMCl+qy+U2xw0PMc5sVB6Lmhl T11ajpZ642+TztsUSGp5u9W90qqu3eQ+U/m+VTzzMnYPwJRIho6kmxlRAStr2mG74NPA0pJuxtFes WaJyoSvlnSgxXb562ovvW9+fwHiUy9xatVdEWF+kfjMX5oMtmVQsWEXe1uN6+8mjbM34dopNYjdSJ AX76bnGiOCgXvCpx9V4o/vQXoG5Wz8UjT/R3GjVHysazSJoOgbkOmBS9mlCwCG0+wT7KZIaJDlcTp yLbVPpiUXGE0iQ5clMdysQXqUZtrRKfbGRTsZ3T4JUCWFXDT4Lbj5aSLHEIbKydfRk/kr2jhKK9qC eBHms+gw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmwrj-0000mB-58; Wed, 09 Dec 2020 10:38:35 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmwre-0000kX-8O for linux-arm-kernel@lists.infradead.org; Wed, 09 Dec 2020 10:38:31 +0000 From: Ard Biesheuvel Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux@armlinux.org.uk Subject: [PATCH 1/3] ARM: assembler: generalize byte swapping macro into rev_32 Date: Wed, 9 Dec 2020 11:36:32 +0100 Message-Id: <20201209103634.1422-2-ardb@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201209103634.1422-1-ardb@kernel.org> References: <20201209103634.1422-1-ardb@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201209_053830_528741_393F52C6 X-CRM114-Status: UNSURE ( 8.53 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Geert Uytterhoeven , Eric Biggers , Linus Walleij , Nicolas Pitre , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Take the 4 instruction byte swapping sequence from the decompressor's head.S, and turn it into a rev_32 GAS macro for general use. While at it, make it use the 'rev' instruction when compiling for v6 or later. Signed-off-by: Ard Biesheuvel --- arch/arm/boot/compressed/head.S | 5 +---- arch/arm/include/asm/assembler.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 804d66668019..d70c78ab68c8 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -174,10 +174,7 @@ .macro be32tocpu, val, tmp #ifndef __ARMEB__ /* convert to little endian */ - eor \tmp, \val, \val, ror #16 - bic \tmp, \tmp, #0x00ff0000 - mov \val, \val, ror #8 - eor \val, \val, \tmp, lsr #8 + rev_32 \val, \tmp #endif .endm diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h index 6ed30421f697..a674eba4cd27 100644 --- a/arch/arm/include/asm/assembler.h +++ b/arch/arm/include/asm/assembler.h @@ -578,4 +578,15 @@ THUMB( orr \reg , \reg , #PSR_T_BIT ) __adldst_l str, \src, \sym, \tmp, \cond .endm + .macro rev_32, val:req, tmp:req + .if __LINUX_ARM_ARCH__ < 6 + eor \tmp, \val, \val, ror #16 + bic \tmp, \tmp, #0x00ff0000 + mov \val, \val, ror #8 + eor \val, \val, \tmp, lsr #8 + .else + rev \val, \val + .endif + .endm + #endif /* __ASM_ASSEMBLER_H__ */ -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel