aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2007-05-02 13:27:13 -0400
committerAndi Kleen <andi@basil.nowhere.org>2007-05-02 13:27:13 -0400
commit45876233605c268e929a7875081e129debe34bdc (patch)
treec16487f8e8428e86ecf9802c8ba0da82225622ee
parent7f63c41c6c57371a0931da3940c6620c2301442c (diff)
[PATCH] i386: PARAVIRT: use paravirt_nop to consistently mark no-op operations
Add a _paravirt_nop function for use as a stub for no-op operations, and paravirt_nop #defined void * version to make using it easier (since all its uses are as a void *). This is useful to allow the patcher to automatically identify noop operations so it can simply nop out the callsite. Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com> Signed-off-by: Andi Kleen <ak@suse.de> Acked-by: Ingo Molnar <mingo@elte.hu> [mingo] but only as a cleanup of the current open-coded (void *) casts. My problem with this is that it loses the types. Not that there is much to check for, but still, this adds some assumptions about how function calls look like
-rw-r--r--arch/i386/kernel/paravirt.c24
-rw-r--r--include/asm-i386/paravirt.h3
2 files changed, 15 insertions, 12 deletions
diff --git a/arch/i386/kernel/paravirt.c b/arch/i386/kernel/paravirt.c
index 47698756aec5..3fdbd1f62379 100644
--- a/arch/i386/kernel/paravirt.c
+++ b/arch/i386/kernel/paravirt.c
@@ -35,7 +35,7 @@
35#include <asm/timer.h> 35#include <asm/timer.h>
36 36
37/* nop stub */ 37/* nop stub */
38static void native_nop(void) 38void _paravirt_nop(void)
39{ 39{
40} 40}
41 41
@@ -207,7 +207,7 @@ struct paravirt_ops paravirt_ops = {
207 207
208 .patch = native_patch, 208 .patch = native_patch,
209 .banner = default_banner, 209 .banner = default_banner,
210 .arch_setup = native_nop, 210 .arch_setup = paravirt_nop,
211 .memory_setup = machine_specific_memory_setup, 211 .memory_setup = machine_specific_memory_setup,
212 .get_wallclock = native_get_wallclock, 212 .get_wallclock = native_get_wallclock,
213 .set_wallclock = native_set_wallclock, 213 .set_wallclock = native_set_wallclock,
@@ -263,25 +263,25 @@ struct paravirt_ops paravirt_ops = {
263 .setup_boot_clock = setup_boot_APIC_clock, 263 .setup_boot_clock = setup_boot_APIC_clock,
264 .setup_secondary_clock = setup_secondary_APIC_clock, 264 .setup_secondary_clock = setup_secondary_APIC_clock,
265#endif 265#endif
266 .set_lazy_mode = (void *)native_nop, 266 .set_lazy_mode = paravirt_nop,
267 267
268 .flush_tlb_user = native_flush_tlb, 268 .flush_tlb_user = native_flush_tlb,
269 .flush_tlb_kernel = native_flush_tlb_global, 269 .flush_tlb_kernel = native_flush_tlb_global,
270 .flush_tlb_single = native_flush_tlb_single, 270 .flush_tlb_single = native_flush_tlb_single,
271 271
272 .map_pt_hook = (void *)native_nop, 272 .map_pt_hook = paravirt_nop,
273 273
274 .alloc_pt = (void *)native_nop, 274 .alloc_pt = paravirt_nop,
275 .alloc_pd = (void *)native_nop, 275 .alloc_pd = paravirt_nop,
276 .alloc_pd_clone = (void *)native_nop, 276 .alloc_pd_clone = paravirt_nop,
277 .release_pt = (void *)native_nop, 277 .release_pt = paravirt_nop,
278 .release_pd = (void *)native_nop, 278 .release_pd = paravirt_nop,
279 279
280 .set_pte = native_set_pte, 280 .set_pte = native_set_pte,
281 .set_pte_at = native_set_pte_at, 281 .set_pte_at = native_set_pte_at,
282 .set_pmd = native_set_pmd, 282 .set_pmd = native_set_pmd,
283 .pte_update = (void *)native_nop, 283 .pte_update = paravirt_nop,
284 .pte_update_defer = (void *)native_nop, 284 .pte_update_defer = paravirt_nop,
285#ifdef CONFIG_X86_PAE 285#ifdef CONFIG_X86_PAE
286 .set_pte_atomic = native_set_pte_atomic, 286 .set_pte_atomic = native_set_pte_atomic,
287 .set_pte_present = native_set_pte_present, 287 .set_pte_present = native_set_pte_present,
@@ -293,7 +293,7 @@ struct paravirt_ops paravirt_ops = {
293 .irq_enable_sysexit = native_irq_enable_sysexit, 293 .irq_enable_sysexit = native_irq_enable_sysexit,
294 .iret = native_iret, 294 .iret = native_iret,
295 295
296 .startup_ipi_hook = (void *)native_nop, 296 .startup_ipi_hook = paravirt_nop,
297}; 297};
298 298
299/* 299/*
diff --git a/include/asm-i386/paravirt.h b/include/asm-i386/paravirt.h
index 32acebce9ae2..f0bdaea6235d 100644
--- a/include/asm-i386/paravirt.h
+++ b/include/asm-i386/paravirt.h
@@ -434,6 +434,9 @@ static inline void pmd_clear(pmd_t *pmdp)
434#define arch_leave_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE) 434#define arch_leave_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE)
435#define arch_flush_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_FLUSH) 435#define arch_flush_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_FLUSH)
436 436
437void _paravirt_nop(void);
438#define paravirt_nop ((void *)_paravirt_nop)
439
437/* These all sit in the .parainstructions section to tell us what to patch. */ 440/* These all sit in the .parainstructions section to tell us what to patch. */
438struct paravirt_patch { 441struct paravirt_patch {
439 u8 *instr; /* original instructions */ 442 u8 *instr; /* original instructions */