@@ -129,13 +129,30 @@ static void unmap_patch_area(unsigned long addr)
129
129
flush_tlb_kernel_range (addr , addr + PAGE_SIZE );
130
130
}
131
131
132
+ static int __do_patch_instruction (u32 * addr , ppc_inst_t instr )
133
+ {
134
+ int err ;
135
+ u32 * patch_addr ;
136
+ unsigned long text_poke_addr ;
137
+
138
+ text_poke_addr = (unsigned long )__this_cpu_read (text_poke_area )-> addr ;
139
+ patch_addr = (u32 * )(text_poke_addr + offset_in_page (addr ));
140
+
141
+ err = map_patch_area (addr , text_poke_addr );
142
+ if (err )
143
+ return err ;
144
+
145
+ err = __patch_instruction (addr , instr , patch_addr );
146
+
147
+ unmap_patch_area (text_poke_addr );
148
+
149
+ return err ;
150
+ }
151
+
132
152
static int do_patch_instruction (u32 * addr , ppc_inst_t instr )
133
153
{
134
154
int err ;
135
- u32 * patch_addr = NULL ;
136
155
unsigned long flags ;
137
- unsigned long text_poke_addr ;
138
- unsigned long kaddr = (unsigned long )addr ;
139
156
140
157
/*
141
158
* During early early boot patch_instruction is called
@@ -146,19 +163,7 @@ static int do_patch_instruction(u32 *addr, ppc_inst_t instr)
146
163
return raw_patch_instruction (addr , instr );
147
164
148
165
local_irq_save (flags );
149
-
150
- text_poke_addr = (unsigned long )__this_cpu_read (text_poke_area )-> addr ;
151
- err = map_patch_area (addr , text_poke_addr );
152
- if (err )
153
- goto out ;
154
-
155
- patch_addr = (u32 * )(text_poke_addr + (kaddr & ~PAGE_MASK ));
156
-
157
- err = __patch_instruction (addr , instr , patch_addr );
158
-
159
- unmap_patch_area (text_poke_addr );
160
-
161
- out :
166
+ err = __do_patch_instruction (addr , instr );
162
167
local_irq_restore (flags );
163
168
164
169
return err ;
0 commit comments