aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/alternative.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86/alternative.h')
-rw-r--r--include/asm-x86/alternative.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/include/asm-x86/alternative.h b/include/asm-x86/alternative.h
index d8bacf3c4b0..d26416b5722 100644
--- a/include/asm-x86/alternative.h
+++ b/include/asm-x86/alternative.h
@@ -156,6 +156,27 @@ apply_paravirt(struct paravirt_patch_site *start,
156#define __parainstructions_end NULL 156#define __parainstructions_end NULL
157#endif 157#endif
158 158
159extern void text_poke(void *addr, unsigned char *opcode, int len); 159extern void add_nops(void *insns, unsigned int len);
160
161/*
162 * Clear and restore the kernel write-protection flag on the local CPU.
163 * Allows the kernel to edit read-only pages.
164 * Side-effect: any interrupt handler running between save and restore will have
165 * the ability to write to read-only pages.
166 *
167 * Warning:
168 * Code patching in the UP case is safe if NMIs and MCE handlers are stopped and
169 * no thread can be preempted in the instructions being modified (no iret to an
170 * invalid instruction possible) or if the instructions are changed from a
171 * consistent state to another consistent state atomically.
172 * More care must be taken when modifying code in the SMP case because of
173 * Intel's errata.
174 * On the local CPU you need to be protected again NMI or MCE handlers seeing an
175 * inconsistent instruction while you patch.
176 * The _early version expects the memory to already be RW.
177 */
178
179extern void *text_poke(void *addr, const void *opcode, size_t len);
180extern void *text_poke_early(void *addr, const void *opcode, size_t len);
160 181
161#endif /* _ASM_X86_ALTERNATIVE_H */ 182#endif /* _ASM_X86_ALTERNATIVE_H */