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=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=unavailable 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 1786AC43219 for ; Mon, 29 Apr 2019 11:56:27 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 BD5FE214AF for ; Mon, 29 Apr 2019 11:56:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BD5FE214AF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44t3611RXYzDqQR for ; Mon, 29 Apr 2019 21:56:25 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=permerror (mailfrom) smtp.mailfrom=kernel.crashing.org (client-ip=63.228.1.57; helo=gate.crashing.org; envelope-from=segher@kernel.crashing.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44t3494pYhzDqS6 for ; Mon, 29 Apr 2019 21:54:49 +1000 (AEST) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id x3TBsWU9018817; Mon, 29 Apr 2019 06:54:32 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id x3TBsV00018809; Mon, 29 Apr 2019 06:54:31 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 29 Apr 2019 06:54:31 -0500 From: Segher Boessenkool To: Christophe Leroy Subject: Re: [PATCH 2/3] powerpc/module32: Use symbolic instructions names. Message-ID: <20190429115431.GN8599@gate.crashing.org> References: <23167861f6095456b4ba3b52c55a514201ca738f.1556534520.git.christophe.leroy@c-s.fr> <14f88b27ff94f2d5a07a8cbc33ec75e2f8af9cf9.1556534520.git.christophe.leroy@c-s.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <14f88b27ff94f2d5a07a8cbc33ec75e2f8af9cf9.1556534520.git.christophe.leroy@c-s.fr> User-Agent: Mutt/1.4.2.3i X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Mackerras , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Mon, Apr 29, 2019 at 10:43:27AM +0000, Christophe Leroy wrote: > To increase readability/maintainability, replace hard coded > instructions values by symbolic names. > + /* lis r12,sym@ha */ > +#define ENTRY_JMP0(sym) (PPC_INST_ADDIS | __PPC_RT(R12) | PPC_HA(sym)) > + /* addi r12,r12,sym@l */ > +#define ENTRY_JMP1(sym) (PPC_INST_ADDI | __PPC_RT(R12) | __PPC_RA(R12) | PPC_LO(sym)) Those aren't "jump" instructions though, as the name suggests... And you only have names for the first two of the four insns. ("2" and "3" were still available ;-) ) > - entry->jump[0] = 0x3d800000+((val+0x8000)>>16); /* lis r12,sym@ha */ > - entry->jump[1] = 0x398c0000 + (val&0xffff); /* addi r12,r12,sym@l*/ > - entry->jump[2] = 0x7d8903a6; /* mtctr r12 */ > - entry->jump[3] = 0x4e800420; /* bctr */ > + entry->jump[0] = ENTRY_JMP0(val); > + entry->jump[1] = ENTRY_JMP1(val); > + entry->jump[2] = PPC_INST_MTCTR | __PPC_RS(R12); > + entry->jump[3] = PPC_INST_BCTR; Deleting the comment here is not an improvement imo. Segher