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=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 9E704C43219 for ; Mon, 29 Apr 2019 11:55:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 72B2E2087B for ; Mon, 29 Apr 2019 11:55:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728019AbfD2LzK (ORCPT ); Mon, 29 Apr 2019 07:55:10 -0400 Received: from gate.crashing.org ([63.228.1.57]:36468 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727710AbfD2LzJ (ORCPT ); Mon, 29 Apr 2019 07:55:09 -0400 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 Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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