From: Michael Ellerman <michael@ellerman.id.au>
To: Kumar Gala <galak@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 05/14] powerpc: Add new code patching routines
Date: Thu, 26 Jun 2008 13:54:39 +1000 [thread overview]
Message-ID: <1214452479.32022.17.camel@localhost> (raw)
In-Reply-To: <19A4D5AE-DB7A-4139-88CD-26F1221A5271@kernel.crashing.org>
[-- Attachment #1: Type: text/plain, Size: 2306 bytes --]
On Tue, 2008-06-24 at 08:48 -0500, Kumar Gala wrote:
> On Jun 23, 2008, at 8:32 PM, Michael Ellerman wrote:
>
> > This commit adds some new routines for patching code, they will be
> > used
> > in a following commit.
> >
> > Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> > ---
> > arch/powerpc/lib/code-patching.c | 107 ++++++++++++++++++++++++++
> > +++++++++
> > include/asm-powerpc/code-patching.h | 8 +++
> > 2 files changed, 115 insertions(+), 0 deletions(-)
> >
> > diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/
> > code-patching.c
> > index 430f4c1..27957c4 100644
> > --- a/arch/powerpc/lib/code-patching.c
> > +++ b/arch/powerpc/lib/code-patching.c
> > @@ -41,3 +41,110 @@ unsigned int create_branch(const unsigned int
> > *addr,
> >
> > return instruction;
> > }
> > +
> > +unsigned int create_cond_branch(const unsigned int *addr,
> > + unsigned long target, int flags)
> > +{
>
> it would be nice to have some idea what flags is suppose to be.
Yeah this routine is a bit of kludge, it's really only written for
translate_branch(). As it is, flags just takes any of the bits in a
conditional branch that aren't the opcode or target.
To fully synthesise a conditional branch by hand you'd probably want
another routine which constructs the BO & BI fields for you.
> > +unsigned int translate_branch(const unsigned int *dest, const
> > unsigned int *src)
> > +{
>
> I'm not sure I get what this function is trying to do.
It takes a relative branch at src and returns a new branch of the same
type that could be placed at dest, and would jump to the same target as
the original instruction. I guess I should add some doco :)
> > + unsigned long target;
> > +
> > + target = branch_target(src);
> > +
> > + if (instr_is_branch_iform(*src))
> > + return create_branch(dest, target, *src);
> > + else if (instr_is_branch_bform(*src))
> > + return create_cond_branch(dest, target, *src);
> > +
> > + return 0;
> > +}
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2008-06-26 3:54 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-24 1:32 [PATCH 01/14] powerpc: Move code patching code into arch/powerpc/lib/code-patching.c Michael Ellerman
2008-06-24 1:32 ` [PATCH 02/14] powerpc: Allow create_branch() to return errors Michael Ellerman
2008-06-24 13:20 ` Kumar Gala
2008-06-24 13:26 ` Jon Loeliger
2008-06-24 1:32 ` [PATCH 03/14] powerpc: Make create_branch() return errors if the branch target is too large Michael Ellerman
2008-06-24 13:21 ` Kumar Gala
2008-06-24 1:32 ` [PATCH 04/14] powerpc: Add ppc_function_entry() which gets the entry point for a function Michael Ellerman
2008-06-24 13:39 ` Kumar Gala
2008-06-24 1:32 ` [PATCH 05/14] powerpc: Add new code patching routines Michael Ellerman
2008-06-24 13:48 ` Kumar Gala
2008-06-26 3:54 ` Michael Ellerman [this message]
2008-06-24 1:32 ` [PATCH 06/14] powerpc: Add tests of the " Michael Ellerman
2008-06-24 13:48 ` Kumar Gala
2008-06-24 1:32 ` [PATCH 07/14] powerpc: Add PPC_NOP_INSTR, a hash define for the preferred nop instruction Michael Ellerman
2008-06-24 13:48 ` Kumar Gala
2008-06-24 1:32 ` [PATCH 08/14] powerpc: Split out do_feature_fixups() from cputable.c Michael Ellerman
2008-06-24 13:48 ` Kumar Gala
2008-06-24 1:32 ` [PATCH 09/14] powerpc: Consolidate CPU and firmware feature fixup macros Michael Ellerman
2008-06-24 13:48 ` Kumar Gala
2008-06-24 1:32 ` [PATCH 10/14] powerpc: Consolidate feature fixup macros for 64/32 bit Michael Ellerman
2008-06-24 13:48 ` Kumar Gala
2008-06-26 3:47 ` Michael Ellerman
2008-06-24 1:32 ` [PATCH 11/14] powerpc: Introduce infrastructure for feature sections with alternatives Michael Ellerman
2008-06-24 1:33 ` [PATCH 12/14] powerpc: Add logic to patch alternative feature sections Michael Ellerman
2008-06-24 13:47 ` Kumar Gala
2008-06-26 3:45 ` Michael Ellerman
2008-06-24 1:33 ` [PATCH 13/14] powerpc: Add self-tests of the feature fixup code Michael Ellerman
2008-06-24 1:33 ` [PATCH 14/14] powerpc: Use an alternative feature section in entry_64.S Michael Ellerman
2008-06-24 13:23 ` [PATCH 01/14] powerpc: Move code patching code into arch/powerpc/lib/code-patching.c Kumar Gala
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=1214452479.32022.17.camel@localhost \
--to=michael@ellerman.id.au \
--cc=galak@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.