From: Michael Ellerman <michael@ellerman.id.au>
To: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 2/6] Allow create_branch() to return errors
Date: Thu, 05 Jun 2008 13:48:02 +1000 [thread overview]
Message-ID: <1212637682.8176.10.camel@localhost> (raw)
In-Reply-To: <b5d665dc398cc0822783593ce3a2fc6b62990759.1212042061.git.michael@ellerman.id.au>
[-- Attachment #1: Type: text/plain, Size: 2539 bytes --]
On Thu, 2008-05-29 at 16:20 +1000, Michael Ellerman wrote:
> Currently create_branch() creates a branch instruction for you, and patches
> it into the call site. In some circumstances it would be nice to be able to
> create the instruction and patch it later, and also some code might want
> to check for errors in the branch creation before doing the patching. A
> future patch will change create_branch() to check for errors.
>
> For callers that don't care, replace create_branch() with patch_branch(),
> which just creates the branch and patches it directly.
>
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> ---
> arch/powerpc/kernel/crash_dump.c | 4 ++--
> arch/powerpc/lib/code-patching.c | 11 ++++++++---
> arch/powerpc/platforms/86xx/mpc86xx_smp.c | 2 +-
> arch/powerpc/platforms/powermac/smp.c | 2 +-
> include/asm-powerpc/code-patching.h | 5 +++--
> 5 files changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
> index 35b9a66..ee2dac5 100644
> --- a/arch/powerpc/kernel/crash_dump.c
> +++ b/arch/powerpc/kernel/crash_dump.c
> @@ -42,8 +42,8 @@ static void __init create_trampoline(unsigned long addr)
> * branch to "addr" we jump to ("addr" + 32 MB). Although it requires
> * two instructions it doesn't require any registers.
> */
> - create_instruction(addr, 0x60000000); /* nop */
> - create_branch(addr + 4, addr + PHYSICAL_START, 0);
> + patch_instruction(addr, 0x60000000); /* nop */
> + patch_branch(addr + 4, addr + PHYSICAL_START, 0);
> }
>
> void __init setup_kdump_trampoline(void)
> diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c
> index 7afae88..1391981 100644
> --- a/arch/powerpc/lib/code-patching.c
> +++ b/arch/powerpc/lib/code-patching.c
> @@ -11,7 +11,7 @@
> #include <asm/code-patching.h>
>
>
> -void create_instruction(unsigned long addr, unsigned int instr)
> +void patch_instruction(unsigned long addr, unsigned int instr)
> {
> unsigned int *p;
> p = (unsigned int *)addr;
Reviewing my own patches again .. this should take an unsigned int *
instead of an unsigned long.
I'll repost sometime.
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-05 3:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-29 6:20 [PATCH 1/6] Move code patching code into arch/powerpc/lib/code-patching.c Michael Ellerman
2008-05-29 6:20 ` [PATCH 2/6] Allow create_branch() to return errors Michael Ellerman
2008-05-29 6:31 ` Benjamin Herrenschmidt
2008-06-05 3:48 ` Michael Ellerman [this message]
2008-05-29 6:20 ` [PATCH 3/6] Make create_branch() return errors if the branch target is too large Michael Ellerman
2008-05-29 6:33 ` Benjamin Herrenschmidt
2008-05-29 6:20 ` [PATCH 4/6] Add ppc_function_entry() which gets the entry point for a function Michael Ellerman
2008-05-29 6:37 ` Benjamin Herrenschmidt
2008-05-29 6:57 ` Michael Ellerman
2008-05-29 6:21 ` [PATCH 5/6] Add tests for the code patching code, and introduce checking functions Michael Ellerman
2008-05-29 6:21 ` [PATCH 6/6] Add PPC_NOP_INSTR, a hash define for the preferred nop instruction Michael Ellerman
2008-05-29 6:30 ` [PATCH 1/6] Move code patching code into arch/powerpc/lib/code-patching.c Benjamin Herrenschmidt
2008-06-19 6:15 ` Kumar Gala
2008-06-19 6:55 ` Michael Ellerman
2008-06-19 13:23 ` 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=1212637682.8176.10.camel@localhost \
--to=michael@ellerman.id.au \
--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.