diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2008-06-23 21:32:35 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-06-30 21:28:23 -0400 |
commit | b7bcda631e87eb3466d0baa9885650ba7d7ed89d (patch) | |
tree | 3a04957c5f1b22e2d4405ccdaa980e6e513ef388 | |
parent | ae0dc73625f9b0e636ccd130e394c9b654a062fb (diff) |
powerpc: Add PPC_NOP_INSTR, a hash define for the preferred nop instruction
A bunch of code has hard-coded the value for a "nop" instruction, it
would be nice to have a #define for it.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/kernel/cputable.c | 3 | ||||
-rw-r--r-- | arch/powerpc/kernel/crash_dump.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/module_64.c | 3 | ||||
-rw-r--r-- | include/asm-powerpc/code-patching.h | 2 |
4 files changed, 7 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index f8deb3761de4..ba5b23f54764 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | 18 | ||
19 | #include <asm/oprofile_impl.h> | 19 | #include <asm/oprofile_impl.h> |
20 | #include <asm/code-patching.h> | ||
20 | #include <asm/cputable.h> | 21 | #include <asm/cputable.h> |
21 | #include <asm/prom.h> /* for PTRRELOC on ARCH=ppc */ | 22 | #include <asm/prom.h> /* for PTRRELOC on ARCH=ppc */ |
22 | 23 | ||
@@ -1663,7 +1664,7 @@ void do_feature_fixups(unsigned long value, void *fixup_start, void *fixup_end) | |||
1663 | pend = ((unsigned int *)fcur) + (fcur->end_off / 4); | 1664 | pend = ((unsigned int *)fcur) + (fcur->end_off / 4); |
1664 | 1665 | ||
1665 | for (p = pstart; p < pend; p++) { | 1666 | for (p = pstart; p < pend; p++) { |
1666 | *p = 0x60000000u; | 1667 | *p = PPC_NOP_INSTR; |
1667 | asm volatile ("dcbst 0, %0" : : "r" (p)); | 1668 | asm volatile ("dcbst 0, %0" : : "r" (p)); |
1668 | } | 1669 | } |
1669 | asm volatile ("sync" : : : "memory"); | 1670 | asm volatile ("sync" : : : "memory"); |
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c index 26648544d5e4..e0debcca0bfa 100644 --- a/arch/powerpc/kernel/crash_dump.c +++ b/arch/powerpc/kernel/crash_dump.c | |||
@@ -44,7 +44,7 @@ static void __init create_trampoline(unsigned long addr) | |||
44 | * 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 |
45 | * two instructions it doesn't require any registers. | 45 | * two instructions it doesn't require any registers. |
46 | */ | 46 | */ |
47 | patch_instruction(p, 0x60000000); /* nop */ | 47 | patch_instruction(p, PPC_NOP_INSTR); |
48 | patch_branch(++p, addr + PHYSICAL_START, 0); | 48 | patch_branch(++p, addr + PHYSICAL_START, 0); |
49 | } | 49 | } |
50 | 50 | ||
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c index 4803f2de98dd..ee6a2982d567 100644 --- a/arch/powerpc/kernel/module_64.c +++ b/arch/powerpc/kernel/module_64.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <asm/module.h> | 24 | #include <asm/module.h> |
25 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
26 | #include <asm/firmware.h> | 26 | #include <asm/firmware.h> |
27 | #include <asm/code-patching.h> | ||
27 | #include <linux/sort.h> | 28 | #include <linux/sort.h> |
28 | 29 | ||
29 | #include "setup.h" | 30 | #include "setup.h" |
@@ -330,7 +331,7 @@ static unsigned long stub_for_addr(Elf64_Shdr *sechdrs, | |||
330 | restore r2. */ | 331 | restore r2. */ |
331 | static int restore_r2(u32 *instruction, struct module *me) | 332 | static int restore_r2(u32 *instruction, struct module *me) |
332 | { | 333 | { |
333 | if (*instruction != 0x60000000) { | 334 | if (*instruction != PPC_NOP_INSTR) { |
334 | printk("%s: Expect noop after relocate, got %08x\n", | 335 | printk("%s: Expect noop after relocate, got %08x\n", |
335 | me->name, *instruction); | 336 | me->name, *instruction); |
336 | return 0; | 337 | return 0; |
diff --git a/include/asm-powerpc/code-patching.h b/include/asm-powerpc/code-patching.h index 40ad46b1dd9d..ef3a5d156dba 100644 --- a/include/asm-powerpc/code-patching.h +++ b/include/asm-powerpc/code-patching.h | |||
@@ -12,6 +12,8 @@ | |||
12 | 12 | ||
13 | #include <asm/types.h> | 13 | #include <asm/types.h> |
14 | 14 | ||
15 | #define PPC_NOP_INSTR 0x60000000 | ||
16 | |||
15 | /* Flags for create_branch: | 17 | /* Flags for create_branch: |
16 | * "b" == create_branch(addr, target, 0); | 18 | * "b" == create_branch(addr, target, 0); |
17 | * "ba" == create_branch(addr, target, BRANCH_ABSOLUTE); | 19 | * "ba" == create_branch(addr, target, BRANCH_ABSOLUTE); |