diff options
Diffstat (limited to 'include/asm-i386/alternative.h')
-rw-r--r-- | include/asm-i386/alternative.h | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/include/asm-i386/alternative.h b/include/asm-i386/alternative.h index e201decea0c..b01a7ec409c 100644 --- a/include/asm-i386/alternative.h +++ b/include/asm-i386/alternative.h | |||
@@ -3,6 +3,10 @@ | |||
3 | 3 | ||
4 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
5 | 5 | ||
6 | #include <asm/types.h> | ||
7 | |||
8 | #include <linux/types.h> | ||
9 | |||
6 | struct alt_instr { | 10 | struct alt_instr { |
7 | u8 *instr; /* original instruction */ | 11 | u8 *instr; /* original instruction */ |
8 | u8 *replacement; | 12 | u8 *replacement; |
@@ -15,11 +19,19 @@ struct alt_instr { | |||
15 | extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end); | 19 | extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end); |
16 | 20 | ||
17 | struct module; | 21 | struct module; |
22 | #ifdef CONFIG_SMP | ||
18 | extern void alternatives_smp_module_add(struct module *mod, char *name, | 23 | extern void alternatives_smp_module_add(struct module *mod, char *name, |
19 | void *locks, void *locks_end, | 24 | void *locks, void *locks_end, |
20 | void *text, void *text_end); | 25 | void *text, void *text_end); |
21 | extern void alternatives_smp_module_del(struct module *mod); | 26 | extern void alternatives_smp_module_del(struct module *mod); |
22 | extern void alternatives_smp_switch(int smp); | 27 | extern void alternatives_smp_switch(int smp); |
28 | #else | ||
29 | static inline void alternatives_smp_module_add(struct module *mod, char *name, | ||
30 | void *locks, void *locks_end, | ||
31 | void *text, void *text_end) {} | ||
32 | static inline void alternatives_smp_module_del(struct module *mod) {} | ||
33 | static inline void alternatives_smp_switch(int smp) {} | ||
34 | #endif | ||
23 | 35 | ||
24 | #endif | 36 | #endif |
25 | 37 | ||
@@ -76,9 +88,6 @@ extern void alternatives_smp_switch(int smp); | |||
76 | /* | 88 | /* |
77 | * Alternative inline assembly for SMP. | 89 | * Alternative inline assembly for SMP. |
78 | * | 90 | * |
79 | * alternative_smp() takes two versions (SMP first, UP second) and is | ||
80 | * for more complex stuff such as spinlocks. | ||
81 | * | ||
82 | * The LOCK_PREFIX macro defined here replaces the LOCK and | 91 | * The LOCK_PREFIX macro defined here replaces the LOCK and |
83 | * LOCK_PREFIX macros used everywhere in the source tree. | 92 | * LOCK_PREFIX macros used everywhere in the source tree. |
84 | * | 93 | * |
@@ -98,21 +107,6 @@ extern void alternatives_smp_switch(int smp); | |||
98 | */ | 107 | */ |
99 | 108 | ||
100 | #ifdef CONFIG_SMP | 109 | #ifdef CONFIG_SMP |
101 | #define alternative_smp(smpinstr, upinstr, args...) \ | ||
102 | asm volatile ("661:\n\t" smpinstr "\n662:\n" \ | ||
103 | ".section .smp_altinstructions,\"a\"\n" \ | ||
104 | " .align 4\n" \ | ||
105 | " .long 661b\n" /* label */ \ | ||
106 | " .long 663f\n" /* new instruction */ \ | ||
107 | " .byte 0x68\n" /* X86_FEATURE_UP */ \ | ||
108 | " .byte 662b-661b\n" /* sourcelen */ \ | ||
109 | " .byte 664f-663f\n" /* replacementlen */ \ | ||
110 | ".previous\n" \ | ||
111 | ".section .smp_altinstr_replacement,\"awx\"\n" \ | ||
112 | "663:\n\t" upinstr "\n" /* replacement */ \ | ||
113 | "664:\n\t.fill 662b-661b,1,0x42\n" /* space for original */ \ | ||
114 | ".previous" : args) | ||
115 | |||
116 | #define LOCK_PREFIX \ | 110 | #define LOCK_PREFIX \ |
117 | ".section .smp_locks,\"a\"\n" \ | 111 | ".section .smp_locks,\"a\"\n" \ |
118 | " .align 4\n" \ | 112 | " .align 4\n" \ |
@@ -121,8 +115,6 @@ extern void alternatives_smp_switch(int smp); | |||
121 | "661:\n\tlock; " | 115 | "661:\n\tlock; " |
122 | 116 | ||
123 | #else /* ! CONFIG_SMP */ | 117 | #else /* ! CONFIG_SMP */ |
124 | #define alternative_smp(smpinstr, upinstr, args...) \ | ||
125 | asm volatile (upinstr : args) | ||
126 | #define LOCK_PREFIX "" | 118 | #define LOCK_PREFIX "" |
127 | #endif | 119 | #endif |
128 | 120 | ||