This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / arch / ia64 / kernel / patch.c
index ef04f5d..bc11bb0 100644 (file)
@@ -64,22 +64,30 @@ ia64_patch (u64 insn_addr, u64 mask, u64 val)
 void
 ia64_patch_imm64 (u64 insn_addr, u64 val)
 {
-       ia64_patch(insn_addr,
-                  0x01fffefe000, (  ((val & 0x8000000000000000) >> 27) /* bit 63 -> 36 */
-                                  | ((val & 0x0000000000200000) <<  0) /* bit 21 -> 21 */
-                                  | ((val & 0x00000000001f0000) <<  6) /* bit 16 -> 22 */
-                                  | ((val & 0x000000000000ff80) << 20) /* bit  7 -> 27 */
-                                  | ((val & 0x000000000000007f) << 13) /* bit  0 -> 13 */));
-       ia64_patch(insn_addr - 1, 0x1ffffffffff, val >> 22);
+       /* The assembler may generate offset pointing to either slot 1
+          or slot 2 for a long (2-slot) instruction, occupying slots 1
+          and 2.  */
+       insn_addr &= -16UL;
+       ia64_patch(insn_addr + 2,
+                  0x01fffefe000UL, (  ((val & 0x8000000000000000UL) >> 27) /* bit 63 -> 36 */
+                                    | ((val & 0x0000000000200000UL) <<  0) /* bit 21 -> 21 */
+                                    | ((val & 0x00000000001f0000UL) <<  6) /* bit 16 -> 22 */
+                                    | ((val & 0x000000000000ff80UL) << 20) /* bit  7 -> 27 */
+                                    | ((val & 0x000000000000007fUL) << 13) /* bit  0 -> 13 */));
+       ia64_patch(insn_addr + 1, 0x1ffffffffffUL, val >> 22);
 }
 
 void
 ia64_patch_imm60 (u64 insn_addr, u64 val)
 {
-       ia64_patch(insn_addr,
-                  0x011ffffe000, (  ((val & 0x0800000000000000) >> 23) /* bit 59 -> 36 */
-                                  | ((val & 0x00000000000fffff) << 13) /* bit  0 -> 13 */));
-       ia64_patch(insn_addr - 1, 0x1fffffffffc, val >> 18);
+       /* The assembler may generate offset pointing to either slot 1
+          or slot 2 for a long (2-slot) instruction, occupying slots 1
+          and 2.  */
+       insn_addr &= -16UL;
+       ia64_patch(insn_addr + 2,
+                  0x011ffffe000UL, (  ((val & 0x0800000000000000UL) >> 23) /* bit 59 -> 36 */
+                                    | ((val & 0x00000000000fffffUL) << 13) /* bit  0 -> 13 */));
+       ia64_patch(insn_addr + 1, 0x1fffffffffcUL, val >> 18);
 }
 
 /*
@@ -107,7 +115,7 @@ ia64_patch_vtop (unsigned long start, unsigned long end)
        ia64_srlz_i();
 }
 
-void
+void __init
 ia64_patch_mckinley_e9 (unsigned long start, unsigned long end)
 {
        static int first_time = 1;
@@ -130,10 +138,10 @@ ia64_patch_mckinley_e9 (unsigned long start, unsigned long end)
 
        while (offp < (s32 *) end) {
                wp = (u64 *) ia64_imva((char *) offp + *offp);
-               wp[0] = 0x0000000100000000; /* nop.m 0; nop.i 0; nop.i 0 */
-               wp[1] = 0x0004000000000200;
-               wp[2] = 0x0000000100000011; /* nop.m 0; nop.i 0; br.ret.sptk.many b6 */
-               wp[3] = 0x0084006880000200;
+               wp[0] = 0x0000000100000000UL; /* nop.m 0; nop.i 0; nop.i 0 */
+               wp[1] = 0x0004000000000200UL;
+               wp[2] = 0x0000000100000011UL; /* nop.m 0; nop.i 0; br.ret.sptk.many b6 */
+               wp[3] = 0x0084006880000200UL;
                ia64_fc(wp); ia64_fc(wp + 2);
                ++offp;
        }
@@ -141,7 +149,7 @@ ia64_patch_mckinley_e9 (unsigned long start, unsigned long end)
        ia64_srlz_i();
 }
 
-static void
+static void __init
 patch_fsyscall_table (unsigned long start, unsigned long end)
 {
        extern unsigned long fsyscall_table[NR_syscalls];
@@ -158,7 +166,7 @@ patch_fsyscall_table (unsigned long start, unsigned long end)
        ia64_srlz_i();
 }
 
-static void
+static void __init
 patch_brl_fsys_bubble_down (unsigned long start, unsigned long end)
 {
        extern char fsys_bubble_down[];
@@ -176,7 +184,7 @@ patch_brl_fsys_bubble_down (unsigned long start, unsigned long end)
        ia64_srlz_i();
 }
 
-void
+void __init
 ia64_patch_gate (void)
 {
 #      define START(name)      ((unsigned long) __start_gate_##name##_patchlist)