Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6614159ybi; Mon, 8 Jul 2019 05:58:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxkjLJnCZ8NZCfGPw5jNmpoDwmDKHsq5uM8ubxygsJ18WjgLRKrDcqAuSBd5JfslELHl73A X-Received: by 2002:a63:3203:: with SMTP id y3mr184402pgy.191.1562590705980; Mon, 08 Jul 2019 05:58:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562590705; cv=none; d=google.com; s=arc-20160816; b=fuxiuZZIK5zRZGIXlGi1GkxiGm96ZGyLMtsWWMeypbtDOaYwhbyKPorr9dbGuHHIwO yYNQN1s51AXSfB2y52407ly3Ol13Lz0tKCCoJE8rNfM8wYu3D9cTHCoNC8JS4o1Haaok WnrZYgJJSawnpjFGIWG6aC3QH8y/4nuI23+ZTSAmsnqoHAygxuZqTsHCBge76l4jw5SD J7BycLtl4NVkR18N8S7khRAn4vWvYn8WngREROArb98/9DGlPS29FzlBRSTKPqBF6ec8 /s4QTEd8REr6yQ0dk2fH7jK92YAfB6vrZcaxT37z+q7xaQDFBVv0n7Y0icK6moh3h8+S sRvg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=SEEbC4SVXv54ubiPmqZ/ohTZiQJHhOXXhOXl6IoW5uo=; b=h3UkkSrOU4OXz3ThZ38WWoGMA3bEXFgGDuz+/hU/2NxjjjQgHjZK6spUnew5vvF/LF /mXv/BcW5G53W6NdxdenIrTieoZns2KP5jeCzHK2ncRDsF8QW49WVnOshS/S49Zici2a jcKjxjNyRU4pv8UA5VSqktePa/Oaeq7I1efGg6z60nP3O528uCgrektwNk6Q8ftzLt6i +JhV1t3lhHCtZP5Mmfo8Al9FQr1H4+mq+YUj6MzvlEZ7HUJPip1tMkOuQBpspPS7ZtQy 70AAzqWa85KTkVtdIXuX2T0n/fHsUtxSVMKPKNQri/vSE2sfBV8MWwQJzEqZnV8VI08C Q1Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=kCkonxU1; 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 f91si18501301plf.300.2019.07.08.05.58.11; Mon, 08 Jul 2019 05:58:25 -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; dkim=pass header.i=@c-s.fr header.s=mail header.b=kCkonxU1; 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 S1728672AbfGHI6Y (ORCPT + 99 others); Mon, 8 Jul 2019 04:58:24 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:62390 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727384AbfGHI6Y (ORCPT ); Mon, 8 Jul 2019 04:58:24 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 45hzr9568jz9txqj; Mon, 8 Jul 2019 10:58:17 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=kCkonxU1; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id ZqjmSVTnCCYU; Mon, 8 Jul 2019 10:58:17 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 45hzr93xKRz9txqh; Mon, 8 Jul 2019 10:58:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1562576297; bh=SEEbC4SVXv54ubiPmqZ/ohTZiQJHhOXXhOXl6IoW5uo=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=kCkonxU12IqU+OKoT05jmROmtyo56NkBiacWHjmlTOlOlpzmHasGBbSVt49awlH4a Ohvd50OfTyqC0MMR/Y/9hwvvVqL9oAhvHf6y1Fp0jfEBkr1KgWs5ACvOxOcuJmT6Xq 4Vvk15dmwt8kvZk6z/25IRcXmt8UoTUKAIuyHbAQ= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 3D1998B790; Mon, 8 Jul 2019 10:58:22 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id U1bNWRlSm0cg; Mon, 8 Jul 2019 10:58:22 +0200 (CEST) Received: from [172.25.230.102] (po15451.idsi0.si.c-s.fr [172.25.230.102]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 1CA328B78C; Mon, 8 Jul 2019 10:58:22 +0200 (CEST) Subject: Re: [PATCH v3 3/3] powerpc/module64: Use symbolic instructions names. To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Ulirch Weigand References: <298f344bdb21ab566271f5d18c6782ed20f072b7.1556865423.git.christophe.leroy@c-s.fr> <6fb61d1c9104b0324d4a9c445f431c0928c7ea25.1556865423.git.christophe.leroy@c-s.fr> <87bly5ibsd.fsf@concordia.ellerman.id.au> From: Christophe Leroy Message-ID: <9bc00fb4-379a-e19b-4d27-32fff8f9781b@c-s.fr> Date: Mon, 8 Jul 2019 10:58:22 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <87bly5ibsd.fsf@concordia.ellerman.id.au> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Christophe > > Fixed now. > > cheers >