powerpc: Add PPC_NOP_INSTR, a hash define for the preferred nop instruction
authorMichael Ellerman <michael@ellerman.id.au>
Tue, 24 Jun 2008 01:32:35 +0000 (11:32 +1000)
committerPaul Mackerras <paulus@samba.org>
Tue, 1 Jul 2008 01:28:23 +0000 (11:28 +1000)
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>
arch/powerpc/kernel/cputable.c
arch/powerpc/kernel/crash_dump.c
arch/powerpc/kernel/module_64.c
include/asm-powerpc/code-patching.h

index f8deb3761de41b61f61ad55aadece94cc50dcd65..ba5b23f547641e5222537b63f06893f5b6a55b41 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/module.h>
 
 #include <asm/oprofile_impl.h>
+#include <asm/code-patching.h>
 #include <asm/cputable.h>
 #include <asm/prom.h>          /* for PTRRELOC on ARCH=ppc */
 
@@ -1663,7 +1664,7 @@ void do_feature_fixups(unsigned long value, void *fixup_start, void *fixup_end)
                pend = ((unsigned int *)fcur) + (fcur->end_off / 4);
 
                for (p = pstart; p < pend; p++) {
-                       *p = 0x60000000u;
+                       *p = PPC_NOP_INSTR;
                        asm volatile ("dcbst 0, %0" : : "r" (p));
                }
                asm volatile ("sync" : : : "memory");
index 26648544d5e42c4cc30741ff7746f0fa33f0e38c..e0debcca0bfadaf03dbc6f3c35a56f1ad4a3aee2 100644 (file)
@@ -44,7 +44,7 @@ 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.
         */
-       patch_instruction(p, 0x60000000); /* nop */
+       patch_instruction(p, PPC_NOP_INSTR);
        patch_branch(++p, addr + PHYSICAL_START, 0);
 }
 
index 4803f2de98dd58ff6eb93748d4c750bf069d2073..ee6a2982d567351eb88ace12c2109918af6af59e 100644 (file)
@@ -24,6 +24,7 @@
 #include <asm/module.h>
 #include <asm/uaccess.h>
 #include <asm/firmware.h>
+#include <asm/code-patching.h>
 #include <linux/sort.h>
 
 #include "setup.h"
@@ -330,7 +331,7 @@ static unsigned long stub_for_addr(Elf64_Shdr *sechdrs,
    restore r2. */
 static int restore_r2(u32 *instruction, struct module *me)
 {
-       if (*instruction != 0x60000000) {
+       if (*instruction != PPC_NOP_INSTR) {
                printk("%s: Expect noop after relocate, got %08x\n",
                       me->name, *instruction);
                return 0;
index 40ad46b1dd9d998c07fa62ea8ce7e7bf746581ce..ef3a5d156dbaf3537e311bb5baa90f42545701d3 100644 (file)
@@ -12,6 +12,8 @@
 
 #include <asm/types.h>
 
+#define PPC_NOP_INSTR  0x60000000
+
 /* Flags for create_branch:
  * "b"   == create_branch(addr, target, 0);
  * "ba"  == create_branch(addr, target, BRANCH_ABSOLUTE);