Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[sfrench/cifs-2.6.git] / arch / ia64 / kernel / patch.c
index b83b2c516008d4cdac5db340a53c74dfa8f4444a..68a1311db806b49a918c76ecea4af5ca75a55da0 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/init.h>
 #include <linux/string.h>
 
+#include <asm/paravirt.h>
 #include <asm/patch.h>
 #include <asm/processor.h>
 #include <asm/sections.h>
@@ -169,16 +170,35 @@ ia64_patch_mckinley_e9 (unsigned long start, unsigned long end)
        ia64_srlz_i();
 }
 
+extern unsigned long ia64_native_fsyscall_table[NR_syscalls];
+extern char ia64_native_fsys_bubble_down[];
+struct pv_fsys_data pv_fsys_data __initdata = {
+       .fsyscall_table = (unsigned long *)ia64_native_fsyscall_table,
+       .fsys_bubble_down = (void *)ia64_native_fsys_bubble_down,
+};
+
+unsigned long * __init
+paravirt_get_fsyscall_table(void)
+{
+       return pv_fsys_data.fsyscall_table;
+}
+
+char * __init
+paravirt_get_fsys_bubble_down(void)
+{
+       return pv_fsys_data.fsys_bubble_down;
+}
+
 static void __init
 patch_fsyscall_table (unsigned long start, unsigned long end)
 {
-       extern unsigned long fsyscall_table[NR_syscalls];
+       u64 fsyscall_table = (u64)paravirt_get_fsyscall_table();
        s32 *offp = (s32 *) start;
        u64 ip;
 
        while (offp < (s32 *) end) {
                ip = (u64) ia64_imva((char *) offp + *offp);
-               ia64_patch_imm64(ip, (u64) fsyscall_table);
+               ia64_patch_imm64(ip, fsyscall_table);
                ia64_fc((void *) ip);
                ++offp;
        }
@@ -189,7 +209,7 @@ patch_fsyscall_table (unsigned long start, unsigned long end)
 static void __init
 patch_brl_fsys_bubble_down (unsigned long start, unsigned long end)
 {
-       extern char fsys_bubble_down[];
+       u64 fsys_bubble_down = (u64)paravirt_get_fsys_bubble_down();
        s32 *offp = (s32 *) start;
        u64 ip;
 
@@ -207,13 +227,13 @@ patch_brl_fsys_bubble_down (unsigned long start, unsigned long end)
 void __init
 ia64_patch_gate (void)
 {
-#      define START(name)      ((unsigned long) __start_gate_##name##_patchlist)
-#      define END(name)        ((unsigned long)__end_gate_##name##_patchlist)
+#      define START(name)      paravirt_get_gate_patchlist(PV_GATE_START_##name)
+#      define END(name)        paravirt_get_gate_patchlist(PV_GATE_END_##name)
 
-       patch_fsyscall_table(START(fsyscall), END(fsyscall));
-       patch_brl_fsys_bubble_down(START(brl_fsys_bubble_down), END(brl_fsys_bubble_down));
-       ia64_patch_vtop(START(vtop), END(vtop));
-       ia64_patch_mckinley_e9(START(mckinley_e9), END(mckinley_e9));
+       patch_fsyscall_table(START(FSYSCALL), END(FSYSCALL));
+       patch_brl_fsys_bubble_down(START(BRL_FSYS_BUBBLE_DOWN), END(BRL_FSYS_BUBBLE_DOWN));
+       ia64_patch_vtop(START(VTOP), END(VTOP));
+       ia64_patch_mckinley_e9(START(MCKINLEY_E9), END(MCKINLEY_E9));
 }
 
 void ia64_patch_phys_stack_reg(unsigned long val)
@@ -229,7 +249,7 @@ void ia64_patch_phys_stack_reg(unsigned long val)
        while (offp < end) {
                ip = (u64) offp + *offp;
                ia64_patch(ip, mask, imm);
-               ia64_fc(ip);
+               ia64_fc((void *)ip);
                ++offp;
        }
        ia64_sync_i();