2012-09-21 19:43:09 +00:00
|
|
|
#ifndef _ASM_X86_ALTERNATIVE_ASM_H
|
|
|
|
#define _ASM_X86_ALTERNATIVE_ASM_H
|
|
|
|
|
2007-10-17 16:04:38 +00:00
|
|
|
#ifdef __ASSEMBLY__
|
|
|
|
|
2009-11-27 15:06:16 +00:00
|
|
|
#include <asm/asm.h>
|
2007-10-17 16:04:38 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
.macro LOCK_PREFIX
|
2012-01-03 16:35:40 +00:00
|
|
|
672: lock
|
2012-09-21 19:43:08 +00:00
|
|
|
.pushsection .smp_locks,"a"
|
2010-04-21 15:08:14 +00:00
|
|
|
.balign 4
|
2012-01-03 16:35:40 +00:00
|
|
|
.long 672b - .
|
2012-09-21 19:43:08 +00:00
|
|
|
.popsection
|
2007-10-17 16:04:38 +00:00
|
|
|
.endm
|
|
|
|
#else
|
|
|
|
.macro LOCK_PREFIX
|
|
|
|
.endm
|
|
|
|
#endif
|
|
|
|
|
2014-12-27 09:41:52 +00:00
|
|
|
.macro altinstruction_entry orig alt feature orig_len alt_len pad_len
|
2011-07-13 13:24:10 +00:00
|
|
|
.long \orig - .
|
|
|
|
.long \alt - .
|
2011-05-17 22:29:13 +00:00
|
|
|
.word \feature
|
|
|
|
.byte \orig_len
|
|
|
|
.byte \alt_len
|
2014-12-27 09:41:52 +00:00
|
|
|
.byte \pad_len
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro ALTERNATIVE oldinstr, newinstr, feature
|
|
|
|
140:
|
|
|
|
\oldinstr
|
|
|
|
141:
|
|
|
|
.skip -(((144f-143f)-(141b-140b)) > 0) * ((144f-143f)-(141b-140b)),0x90
|
|
|
|
142:
|
|
|
|
|
|
|
|
.pushsection .altinstructions,"a"
|
|
|
|
altinstruction_entry 140b,143f,\feature,142b-140b,144f-143f,142b-141b
|
|
|
|
.popsection
|
|
|
|
|
|
|
|
.pushsection .altinstr_replacement,"ax"
|
|
|
|
143:
|
|
|
|
\newinstr
|
|
|
|
144:
|
|
|
|
.popsection
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro ALTERNATIVE_2 oldinstr, newinstr1, feature1, newinstr2, feature2
|
|
|
|
140:
|
|
|
|
\oldinstr
|
|
|
|
141:
|
|
|
|
.skip -(((144f-143f)-(141b-140b)) > 0) * ((144f-143f)-(141b-140b)),0x90
|
|
|
|
.skip -(((145f-144f)-(144f-143f)-(141b-140b)) > 0) * ((145f-144f)-(144f-143f)-(141b-140b)),0x90
|
|
|
|
142:
|
|
|
|
|
|
|
|
.pushsection .altinstructions,"a"
|
|
|
|
altinstruction_entry 140b,143f,\feature1,142b-140b,144f-143f,142b-141b
|
|
|
|
altinstruction_entry 140b,144f,\feature2,142b-140b,145f-144f,142b-141b
|
|
|
|
.popsection
|
|
|
|
|
|
|
|
.pushsection .altinstr_replacement,"ax"
|
|
|
|
143:
|
|
|
|
\newinstr1
|
|
|
|
144:
|
|
|
|
\newinstr2
|
|
|
|
145:
|
|
|
|
.popsection
|
2011-05-17 22:29:13 +00:00
|
|
|
.endm
|
|
|
|
|
2007-10-17 16:04:38 +00:00
|
|
|
#endif /* __ASSEMBLY__ */
|
2012-09-21 19:43:09 +00:00
|
|
|
|
|
|
|
#endif /* _ASM_X86_ALTERNATIVE_ASM_H */
|