Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp518260ybi; Fri, 12 Jul 2019 00:00:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7KgMyY9sEzN/iAuFL4EGXK2Ywtkw/xxFEoMFKHY20rqL9TFviHEN4k9ikcklnsOyxJMzm X-Received: by 2002:a17:90a:4f0e:: with SMTP id p14mr9510890pjh.40.1562914846827; Fri, 12 Jul 2019 00:00:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562914846; cv=none; d=google.com; s=arc-20160816; b=vjszJzheYECfySz3XyBGtiBx1/Yo6K+HQj8ugyGZ6vvM/tnvMO8/t7PaPQ9Wwsy/3x wUs+yXUCgc2/WcALVbD1vWvUZkpxcYmO433UgKiWtjFBYAtxJeoWRD8ZxmvCKXFM1VXf m0L7lliyf8CULv9kPDjx3zOEXjdoH6KBbj38DGovHFD+3IW+B63xQQB87Nec5jc6QaeG lvO+khoNTvn35yoVyHZrKsiAAF+m4p4g97r878kjcNe+Tzswgr/dhLVWfAKH+fFL5+cp 7IF4Uyi7DtOhpmsHNM1YohaSVJpyHIm5I81mtj5hzhHrV7ycR+CAXJLtTZ69S6H/F8Qj BsXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from; bh=gDKFgRr0RHhYGESyFIICVIEjyPBXXqTIxdT6Mm9COaU=; b=EOPM7WfENInYTS5s6ScY6vl4pXpRfnN1GRcfyWhNyn2jgQ2aIjQHRlMOr/Y1iucA1Z ZyPfEuSEmwO6v0RHeoa7YCaYKZajQhceub57UBSJ46g6Z8jV4HKOSjCHCbZjPoqfBZkt SZcpKHbSWPinUkzepJc8Z3iaQFi699OlwF+hbjLgDGOL06PInV+y3E2q2I9txR3DA07H ps2zV8t6RmIzSJvD+FilT8IV6syL1Fd52XF+3HiBXaUMJXy7k3Y0C9r5fF0Ulcbiv/NF alQGuvZwYjzkt5KsX8TD5FPHVOUVKLWxHla0PVWCU4tOfad6scxSJE8fvb5d/KdlzfVE EWEg== 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 j185si7495772pge.91.2019.07.12.00.00.30; Fri, 12 Jul 2019 00:00:46 -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 S1726033AbfGLHAM convert rfc822-to-8bit (ORCPT + 99 others); Fri, 12 Jul 2019 03:00:12 -0400 Received: from ozlabs.org ([203.11.71.1]:36685 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725846AbfGLHAM (ORCPT ); Fri, 12 Jul 2019 03:00:12 -0400 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 45lP2107h2z9s00; Fri, 12 Jul 2019 17:00:09 +1000 (AEST) From: Michael Ellerman To: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Ulirch Weigand Subject: Re: [PATCH v3 3/3] powerpc/module64: Use symbolic instructions names. In-Reply-To: <9bc00fb4-379a-e19b-4d27-32fff8f9781b@c-s.fr> References: <298f344bdb21ab566271f5d18c6782ed20f072b7.1556865423.git.christophe.leroy@c-s.fr> <6fb61d1c9104b0324d4a9c445f431c0928c7ea25.1556865423.git.christophe.leroy@c-s.fr> <87bly5ibsd.fsf@concordia.ellerman.id.au> <9bc00fb4-379a-e19b-4d27-32fff8f9781b@c-s.fr> Date: Fri, 12 Jul 2019 17:00:08 +1000 Message-ID: <87wogneo07.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Christophe Leroy writes: > Le 08/07/2019 à 02:56, Michael Ellerman a écrit : >> Christophe Leroy writes: >>> To increase readability/maintainability, replace hard coded >>> instructions values by symbolic names. >>> >>> Signed-off-by: Christophe Leroy >>> --- >>> v3: fixed warning by adding () in an 'if' around X | Y (unlike said in v2 history, this change was forgotten in v2) >>> v2: rearranged comments >>> >>> arch/powerpc/kernel/module_64.c | 53 +++++++++++++++++++++++++++-------------- >>> 1 file changed, 35 insertions(+), 18 deletions(-) >>> >>> diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c >>> index c2e1b06253b8..b33a5d5e2d35 100644 >>> --- a/arch/powerpc/kernel/module_64.c >>> +++ b/arch/powerpc/kernel/module_64.c >>> @@ -704,18 +711,21 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, >> ... >>> /* >>> * If found, replace it with: >>> * addis r2, r12, (.TOC.-func)@ha >>> * addi r2, r12, (.TOC.-func)@l >>> */ >>> - ((uint32_t *)location)[0] = 0x3c4c0000 + PPC_HA(value); >>> - ((uint32_t *)location)[1] = 0x38420000 + PPC_LO(value); >>> + ((uint32_t *)location)[0] = PPC_INST_ADDIS | __PPC_RT(R2) | >>> + __PPC_RA(R12) | PPC_HA(value); >>> + ((uint32_t *)location)[1] = PPC_INST_ADDI | __PPC_RT(R2) | >>> + __PPC_RA(R12) | PPC_LO(value); >>> break; >> >> This was crashing and it's amazing how long you can stare at a >> disassembly and not see the difference between `r2` and `r12` :) > > Argh, yes. I was misleaded by the comment I guess. Sorry for that and > thanks for fixing. No worries, yes the comment was the problem. I fixed that as well. cheers