alternative.h (0cce284537fb42d9c28b9b31038ffc9b464555f5) alternative.h (f5caf621ee357279e759c0911daf6d55c7d36f03)
1#ifndef _ASM_X86_ALTERNATIVE_H
2#define _ASM_X86_ALTERNATIVE_H
3
4#ifndef __ASSEMBLY__
5
6#include <linux/types.h>
7#include <linux/stddef.h>
8#include <linux/stringify.h>

--- 204 unchanged lines hidden (view full) ---

213 * Like alternative_call, but there are two features and respective functions.
214 * If CPU has feature2, function2 is used.
215 * Otherwise, if CPU has feature1, function1 is used.
216 * Otherwise, old function is used.
217 */
218#define alternative_call_2(oldfunc, newfunc1, feature1, newfunc2, feature2, \
219 output, input...) \
220{ \
1#ifndef _ASM_X86_ALTERNATIVE_H
2#define _ASM_X86_ALTERNATIVE_H
3
4#ifndef __ASSEMBLY__
5
6#include <linux/types.h>
7#include <linux/stddef.h>
8#include <linux/stringify.h>

--- 204 unchanged lines hidden (view full) ---

213 * Like alternative_call, but there are two features and respective functions.
214 * If CPU has feature2, function2 is used.
215 * Otherwise, if CPU has feature1, function1 is used.
216 * Otherwise, old function is used.
217 */
218#define alternative_call_2(oldfunc, newfunc1, feature1, newfunc2, feature2, \
219 output, input...) \
220{ \
221 register void *__sp asm(_ASM_SP); \
222 asm volatile (ALTERNATIVE_2("call %P[old]", "call %P[new1]", feature1,\
223 "call %P[new2]", feature2) \
221 asm volatile (ALTERNATIVE_2("call %P[old]", "call %P[new1]", feature1,\
222 "call %P[new2]", feature2) \
224 : output, "+r" (__sp) \
223 : output, ASM_CALL_CONSTRAINT \
225 : [old] "i" (oldfunc), [new1] "i" (newfunc1), \
226 [new2] "i" (newfunc2), ## input); \
227}
228
229/*
230 * use this macro(s) if you need more than one output parameter
231 * in alternative_io
232 */
233#define ASM_OUTPUT2(a...) a
234
235/*
236 * use this macro if you need clobbers but no inputs in
237 * alternative_{input,io,call}()
238 */
239#define ASM_NO_INPUT_CLOBBER(clbr...) "i" (0) : clbr
240
241#endif /* __ASSEMBLY__ */
242
243#endif /* _ASM_X86_ALTERNATIVE_H */
224 : [old] "i" (oldfunc), [new1] "i" (newfunc1), \
225 [new2] "i" (newfunc2), ## input); \
226}
227
228/*
229 * use this macro(s) if you need more than one output parameter
230 * in alternative_io
231 */
232#define ASM_OUTPUT2(a...) a
233
234/*
235 * use this macro if you need clobbers but no inputs in
236 * alternative_{input,io,call}()
237 */
238#define ASM_NO_INPUT_CLOBBER(clbr...) "i" (0) : clbr
239
240#endif /* __ASSEMBLY__ */
241
242#endif /* _ASM_X86_ALTERNATIVE_H */