diff options
author | Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> | 2008-03-06 08:48:49 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:40:58 -0400 |
commit | e587cadd8f47e202a30712e2906a65a0606d5865 (patch) | |
tree | 9df9016b1cba513cc48472d335899ae5e216f8f1 /include/asm-x86/alternative.h | |
parent | 77bf90ed66116a1fc0e2f0554ecac75a54290cc0 (diff) |
x86: enhance DEBUG_RODATA support - alternatives
Fix a memcpy that should be a text_poke (in apply_alternatives).
Use kernel_wp_save/kernel_wp_restore in text_poke to support DEBUG_RODATA
correctly and so the CPU HOTPLUG special case can be removed.
Add text_poke_early, for alternatives and paravirt boot-time and module load
time patching.
Changelog:
- Fix text_set and text_poke alignment check (mixed up bitwise and and or)
- Remove text_set
- Export add_nops, so it can be used by others.
- Document text_poke_early.
- Remove clflush, since it breaks some VIA architectures and is not strictly
necessary.
- Add kerneldoc to text_poke and text_poke_early.
- Create a second vmap instead of using the WP bit to support Xen and VMI.
- Move local_irq disable within text_poke and text_poke_early to be able to
be sleepable in these functions.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
CC: Andi Kleen <andi@firstfloor.org>
CC: pageexec@freemail.hu
CC: H. Peter Anvin <hpa@zytor.com>
CC: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/asm-x86/alternative.h')
-rw-r--r-- | include/asm-x86/alternative.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/include/asm-x86/alternative.h b/include/asm-x86/alternative.h index d8bacf3c4b08..d26416b5722c 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 | ||
159 | extern void text_poke(void *addr, unsigned char *opcode, int len); | 159 | extern 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 | |||
179 | extern void *text_poke(void *addr, const void *opcode, size_t len); | ||
180 | extern 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 */ |