Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3567597yba; Mon, 29 Apr 2019 04:56:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqx51EsPvNCJvkJwx+kP1GtWcb1qhzolYxJ4lvCzJK+fiAGo5ADfi4GHX8677ON59XyVwSvH X-Received: by 2002:aa7:8dd9:: with SMTP id j25mr25723124pfr.18.1556538994701; Mon, 29 Apr 2019 04:56:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556538994; cv=none; d=google.com; s=arc-20160816; b=M9K4NFXJ8vYc1vWGZkjz0bTQWONgVA8uPEJRq8hEoAF72KXh+ns4FUX54bD6TFskZc ImPPPcgzoVPyawYWhFdCisv6wNAx4OPmDX0BOSsUpZDf3cVn4t/c5zGY1ayMnbv0lwN7 xhBrFryLZrEJgFdvLNH/h78B0GpdPWwFNP63sZLuNBMLU296V2pBZkwYKSLqBtSTK6n2 PWK3oO9j0WKHVEdCBKwzXQ6G4WIGBbFnlfyky1Q3KDsnciIhMqGDx3uIJZDRFtaBkHul 6ND2cdlQZvuE0XnNhgkl0mvUys0HAnZWuD5DbY6oRQiUSRf+TOdhVov0TT62PkVFNwQG hhkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=WpTIxyYmq1dYoNcqMLyh8DBS9I4LnkqujdCKAc1z5C8=; b=sb++pCqaqq9073kW5L+4SoUo0U4uqOuBjkY1q2o710F5wv8OvP9LhiP4YnnhU+B//b 9El68eAtrZmBnat0XJOrd1QYDUlhmkyYlcUoPu/6NzVFLVy1rEWDkLkdKqwrDv9b1koJ HLppR1naTFVkXqRqj7Lb6zYW021pC3+ay6EY7BVA0N7D0Kj6yT2q181C+K7GccN8QCFj UJfp7+xSYeAe/IusyP603Lw5TtuHY+x+6hCRWIstkt3bbb5BRJ8MIfQX43/YqVRWClYv R9+hR2P9ayIncCSvt4UnTDENWs1D62XEVFhiyV318wmTe8wwl9D3UbWn/RT2/Kxvy4kt +BIQ== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n19si14526570pgm.344.2019.04.29.04.56.18; Mon, 29 Apr 2019 04:56:34 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727974AbfD2LzK (ORCPT + 99 others); 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