aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/crash_dump.c
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2008-06-23 21:32:22 -0400
committerPaul Mackerras <paulus@samba.org>2008-06-30 21:28:19 -0400
commite7a57273c6407bb6903fbaddec8c2119bf318617 (patch)
tree4d5b787c286e1d0ae64f757ef1f68fedd9743a3c /arch/powerpc/kernel/crash_dump.c
parentaaddd3eacaeaef3503035750b3f21ac2bfe97cbf (diff)
powerpc: Allow create_branch() to return errors
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 commit 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. While we're touching all the callers, change to using unsigned int *, as this seems to match usage better. That allows (and requires) us to remove the volatile in the definition of vector in powermac/smp.c and mpc86xx_smp.c, that's correct because now that we're passing vector as an unsigned int * the compiler knows that it's value might change across the patch_branch() call. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Acked-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Jon Loeliger <jdl@freescale.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/crash_dump.c')
-rw-r--r--arch/powerpc/kernel/crash_dump.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index 35b9a668b0e1..26648544d5e4 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -34,6 +34,8 @@ void __init reserve_kdump_trampoline(void)
34 34
35static void __init create_trampoline(unsigned long addr) 35static void __init create_trampoline(unsigned long addr)
36{ 36{
37 unsigned int *p = (unsigned int *)addr;
38
37 /* The maximum range of a single instruction branch, is the current 39 /* The maximum range of a single instruction branch, is the current
38 * instruction's address + (32 MB - 4) bytes. For the trampoline we 40 * instruction's address + (32 MB - 4) bytes. For the trampoline we
39 * need to branch to current address + 32 MB. So we insert a nop at 41 * need to branch to current address + 32 MB. So we insert a nop at
@@ -42,8 +44,8 @@ static void __init create_trampoline(unsigned long addr)
42 * branch to "addr" we jump to ("addr" + 32 MB). Although it requires 44 * branch to "addr" we jump to ("addr" + 32 MB). Although it requires
43 * two instructions it doesn't require any registers. 45 * two instructions it doesn't require any registers.
44 */ 46 */
45 create_instruction(addr, 0x60000000); /* nop */ 47 patch_instruction(p, 0x60000000); /* nop */
46 create_branch(addr + 4, addr + PHYSICAL_START, 0); 48 patch_branch(++p, addr + PHYSICAL_START, 0);
47} 49}
48 50
49void __init setup_kdump_trampoline(void) 51void __init setup_kdump_trampoline(void)