diff options
Diffstat (limited to 'include/asm-i386/alternative.h')
| -rw-r--r-- | include/asm-i386/alternative.h | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/include/asm-i386/alternative.h b/include/asm-i386/alternative.h index b8fa9557c532..0f70b379b029 100644 --- a/include/asm-i386/alternative.h +++ b/include/asm-i386/alternative.h | |||
| @@ -1,8 +1,6 @@ | |||
| 1 | #ifndef _I386_ALTERNATIVE_H | 1 | #ifndef _I386_ALTERNATIVE_H |
| 2 | #define _I386_ALTERNATIVE_H | 2 | #define _I386_ALTERNATIVE_H |
| 3 | 3 | ||
| 4 | #ifdef __KERNEL__ | ||
| 5 | |||
| 6 | #include <asm/types.h> | 4 | #include <asm/types.h> |
| 7 | #include <linux/stddef.h> | 5 | #include <linux/stddef.h> |
| 8 | #include <linux/types.h> | 6 | #include <linux/types.h> |
| @@ -16,6 +14,7 @@ struct alt_instr { | |||
| 16 | u8 pad; | 14 | u8 pad; |
| 17 | }; | 15 | }; |
| 18 | 16 | ||
| 17 | extern void alternative_instructions(void); | ||
| 19 | extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end); | 18 | extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end); |
| 20 | 19 | ||
| 21 | struct module; | 20 | struct module; |
| @@ -31,9 +30,7 @@ static inline void alternatives_smp_module_add(struct module *mod, char *name, | |||
| 31 | void *text, void *text_end) {} | 30 | void *text, void *text_end) {} |
| 32 | static inline void alternatives_smp_module_del(struct module *mod) {} | 31 | static inline void alternatives_smp_module_del(struct module *mod) {} |
| 33 | static inline void alternatives_smp_switch(int smp) {} | 32 | static inline void alternatives_smp_switch(int smp) {} |
| 34 | #endif | 33 | #endif /* CONFIG_SMP */ |
| 35 | |||
| 36 | #endif | ||
| 37 | 34 | ||
| 38 | /* | 35 | /* |
| 39 | * Alternative instructions for different CPU types or capabilities. | 36 | * Alternative instructions for different CPU types or capabilities. |
| @@ -85,6 +82,21 @@ static inline void alternatives_smp_switch(int smp) {} | |||
| 85 | "663:\n\t" newinstr "\n664:\n" /* replacement */\ | 82 | "663:\n\t" newinstr "\n664:\n" /* replacement */\ |
| 86 | ".previous" :: "i" (feature), ##input) | 83 | ".previous" :: "i" (feature), ##input) |
| 87 | 84 | ||
| 85 | /* Like alternative_input, but with a single output argument */ | ||
| 86 | #define alternative_io(oldinstr, newinstr, feature, output, input...) \ | ||
| 87 | asm volatile ("661:\n\t" oldinstr "\n662:\n" \ | ||
| 88 | ".section .altinstructions,\"a\"\n" \ | ||
| 89 | " .align 4\n" \ | ||
| 90 | " .long 661b\n" /* label */ \ | ||
| 91 | " .long 663f\n" /* new instruction */ \ | ||
| 92 | " .byte %c[feat]\n" /* feature bit */ \ | ||
| 93 | " .byte 662b-661b\n" /* sourcelen */ \ | ||
| 94 | " .byte 664f-663f\n" /* replacementlen */ \ | ||
| 95 | ".previous\n" \ | ||
| 96 | ".section .altinstr_replacement,\"ax\"\n" \ | ||
| 97 | "663:\n\t" newinstr "\n664:\n" /* replacement */ \ | ||
| 98 | ".previous" : output : [feat] "i" (feature), ##input) | ||
| 99 | |||
| 88 | /* | 100 | /* |
| 89 | * Alternative inline assembly for SMP. | 101 | * Alternative inline assembly for SMP. |
| 90 | * | 102 | * |
| @@ -118,15 +130,17 @@ static inline void alternatives_smp_switch(int smp) {} | |||
| 118 | #define LOCK_PREFIX "" | 130 | #define LOCK_PREFIX "" |
| 119 | #endif | 131 | #endif |
| 120 | 132 | ||
| 121 | struct paravirt_patch; | 133 | struct paravirt_patch_site; |
| 122 | #ifdef CONFIG_PARAVIRT | 134 | #ifdef CONFIG_PARAVIRT |
| 123 | void apply_paravirt(struct paravirt_patch *start, struct paravirt_patch *end); | 135 | void apply_paravirt(struct paravirt_patch_site *start, |
| 136 | struct paravirt_patch_site *end); | ||
| 124 | #else | 137 | #else |
| 125 | static inline void | 138 | static inline void |
| 126 | apply_paravirt(struct paravirt_patch *start, struct paravirt_patch *end) | 139 | apply_paravirt(struct paravirt_patch_site *start, |
| 140 | struct paravirt_patch_site *end) | ||
| 127 | {} | 141 | {} |
| 128 | #define __start_parainstructions NULL | 142 | #define __parainstructions NULL |
| 129 | #define __stop_parainstructions NULL | 143 | #define __parainstructions_end NULL |
| 130 | #endif | 144 | #endif |
| 131 | 145 | ||
| 132 | #endif /* _I386_ALTERNATIVE_H */ | 146 | #endif /* _I386_ALTERNATIVE_H */ |
