aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2007-08-10 16:31:03 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-11 18:58:13 -0400
commitab144f5ec64c42218a555ec1dbde6b60cf2982d6 (patch)
treee3a4532e1db116e87060c9b18f4cfbf6258fdba3 /include/asm-i386
parentd3f3c9346979bfa074c64eac5fc3ed5bba4f40ed (diff)
i386: Make patching more robust, fix paravirt issue
Commit 19d36ccdc34f5ed444f8a6af0cbfdb6790eb1177 "x86: Fix alternatives and kprobes to remap write-protected kernel text" uses code which is being patched for patching. In particular, paravirt_ops does patching in two stages: first it calls paravirt_ops.patch, then it fills any remaining instructions with nop_out(). nop_out calls text_poke() which calls lookup_address() which calls pgd_val() (aka paravirt_ops.pgd_val): that call site is one of the places we patch. If we always do patching as one single call to text_poke(), we only need make sure we're not patching the memcpy in text_poke itself. This means the prototype to paravirt_ops.patch needs to change, to marshal the new code into a buffer rather than patching in place as it does now. It also means all patching goes through text_poke(), which is known to be safe (apply_alternatives is also changed to make a single patch). AK: fix compilation on x86-64 (bad rusty!) AK: fix boot on x86-64 (sigh) AK: merged with other patches Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-i386')
-rw-r--r--include/asm-i386/paravirt.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/include/asm-i386/paravirt.h b/include/asm-i386/paravirt.h
index 7df88be2dd9e..9fa3fa9e62d1 100644
--- a/include/asm-i386/paravirt.h
+++ b/include/asm-i386/paravirt.h
@@ -47,7 +47,8 @@ struct paravirt_ops
47 * The patch function should return the number of bytes of code 47 * The patch function should return the number of bytes of code
48 * generated, as we nop pad the rest in generic code. 48 * generated, as we nop pad the rest in generic code.
49 */ 49 */
50 unsigned (*patch)(u8 type, u16 clobber, void *firstinsn, unsigned len); 50 unsigned (*patch)(u8 type, u16 clobber, void *insnbuf,
51 unsigned long addr, unsigned len);
51 52
52 /* Basic arch-specific setup */ 53 /* Basic arch-specific setup */
53 void (*arch_setup)(void); 54 void (*arch_setup)(void);
@@ -253,13 +254,16 @@ extern struct paravirt_ops paravirt_ops;
253 254
254unsigned paravirt_patch_nop(void); 255unsigned paravirt_patch_nop(void);
255unsigned paravirt_patch_ignore(unsigned len); 256unsigned paravirt_patch_ignore(unsigned len);
256unsigned paravirt_patch_call(void *target, u16 tgt_clobbers, 257unsigned paravirt_patch_call(void *insnbuf,
257 void *site, u16 site_clobbers, 258 const void *target, u16 tgt_clobbers,
259 unsigned long addr, u16 site_clobbers,
258 unsigned len); 260 unsigned len);
259unsigned paravirt_patch_jmp(void *target, void *site, unsigned len); 261unsigned paravirt_patch_jmp(const void *target, void *insnbuf,
260unsigned paravirt_patch_default(u8 type, u16 clobbers, void *site, unsigned len); 262 unsigned long addr, unsigned len);
263unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
264 unsigned long addr, unsigned len);
261 265
262unsigned paravirt_patch_insns(void *site, unsigned len, 266unsigned paravirt_patch_insns(void *insnbuf, unsigned len,
263 const char *start, const char *end); 267 const char *start, const char *end);
264 268
265int paravirt_disable_iospace(void); 269int paravirt_disable_iospace(void);