diff options
Diffstat (limited to 'include/asm-x86/alternative.h')
-rw-r--r-- | include/asm-x86/alternative.h | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/include/asm-x86/alternative.h b/include/asm-x86/alternative.h index d8bacf3c4b08..1f6a9ca10126 100644 --- a/include/asm-x86/alternative.h +++ b/include/asm-x86/alternative.h | |||
@@ -66,8 +66,8 @@ extern void alternatives_smp_module_del(struct module *mod); | |||
66 | extern void alternatives_smp_switch(int smp); | 66 | extern void alternatives_smp_switch(int smp); |
67 | #else | 67 | #else |
68 | static inline void alternatives_smp_module_add(struct module *mod, char *name, | 68 | static inline void alternatives_smp_module_add(struct module *mod, char *name, |
69 | void *locks, void *locks_end, | 69 | void *locks, void *locks_end, |
70 | void *text, void *text_end) {} | 70 | void *text, void *text_end) {} |
71 | static inline void alternatives_smp_module_del(struct module *mod) {} | 71 | static inline void alternatives_smp_module_del(struct module *mod) {} |
72 | static inline void alternatives_smp_switch(int smp) {} | 72 | static inline void alternatives_smp_switch(int smp) {} |
73 | #endif /* CONFIG_SMP */ | 73 | #endif /* CONFIG_SMP */ |
@@ -148,14 +148,34 @@ struct paravirt_patch_site; | |||
148 | void apply_paravirt(struct paravirt_patch_site *start, | 148 | void apply_paravirt(struct paravirt_patch_site *start, |
149 | struct paravirt_patch_site *end); | 149 | struct paravirt_patch_site *end); |
150 | #else | 150 | #else |
151 | static inline void | 151 | static inline void apply_paravirt(struct paravirt_patch_site *start, |
152 | apply_paravirt(struct paravirt_patch_site *start, | 152 | struct paravirt_patch_site *end) |
153 | struct paravirt_patch_site *end) | ||
154 | {} | 153 | {} |
155 | #define __parainstructions NULL | 154 | #define __parainstructions NULL |
156 | #define __parainstructions_end NULL | 155 | #define __parainstructions_end NULL |
157 | #endif | 156 | #endif |
158 | 157 | ||
159 | extern void text_poke(void *addr, unsigned char *opcode, int len); | 158 | extern void add_nops(void *insns, unsigned int len); |
159 | |||
160 | /* | ||
161 | * Clear and restore the kernel write-protection flag on the local CPU. | ||
162 | * Allows the kernel to edit read-only pages. | ||
163 | * Side-effect: any interrupt handler running between save and restore will have | ||
164 | * the ability to write to read-only pages. | ||
165 | * | ||
166 | * Warning: | ||
167 | * Code patching in the UP case is safe if NMIs and MCE handlers are stopped and | ||
168 | * no thread can be preempted in the instructions being modified (no iret to an | ||
169 | * invalid instruction possible) or if the instructions are changed from a | ||
170 | * consistent state to another consistent state atomically. | ||
171 | * More care must be taken when modifying code in the SMP case because of | ||
172 | * Intel's errata. | ||
173 | * On the local CPU you need to be protected again NMI or MCE handlers seeing an | ||
174 | * inconsistent instruction while you patch. | ||
175 | * The _early version expects the memory to already be RW. | ||
176 | */ | ||
177 | |||
178 | extern void *text_poke(void *addr, const void *opcode, size_t len); | ||
179 | extern void *text_poke_early(void *addr, const void *opcode, size_t len); | ||
160 | 180 | ||
161 | #endif /* _ASM_X86_ALTERNATIVE_H */ | 181 | #endif /* _ASM_X86_ALTERNATIVE_H */ |