From: Segher Boessenkool <segher@kernel.crashing.org>
To: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: Paul Mackerras <paulus@samba.org>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] powerpc/module32: Use symbolic instructions names.
Date: Mon, 29 Apr 2019 06:54:31 -0500 [thread overview]
Message-ID: <20190429115431.GN8599@gate.crashing.org> (raw)
In-Reply-To: <14f88b27ff94f2d5a07a8cbc33ec75e2f8af9cf9.1556534520.git.christophe.leroy@c-s.fr>
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
next prev parent reply other threads:[~2019-04-29 11:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-29 10:43 [PATCH 1/3] powerpc: Move PPC_HA() PPC_HI() and PPC_LO() to ppc-opcode.h Christophe Leroy
2019-04-29 10:43 ` [PATCH 2/3] powerpc/module32: Use symbolic instructions names Christophe Leroy
2019-04-29 11:54 ` Segher Boessenkool [this message]
2019-05-02 7:24 ` Christophe Leroy
2019-04-29 10:43 ` [PATCH 3/3] powerpc/module64: " Christophe Leroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190429115431.GN8599@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=christophe.leroy@c-s.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).