1 #ifndef _ASM_X86_ALTERNATIVE_ASM_H
2 #define _ASM_X86_ALTERNATIVE_ASM_H
11 .pushsection .smp_locks,"a"
21 .macro altinstruction_entry orig alt feature orig_len alt_len pad_len
30 .macro ALTERNATIVE oldinstr, newinstr, feature
34 .skip -(((144f-143f)-(141b-140b)) > 0) * ((144f-143f)-(141b-140b)),0x90
37 .pushsection .altinstructions,"a"
38 altinstruction_entry 140b,143f,\feature,142b-140b,144f-143f,142b-141b
41 .pushsection .altinstr_replacement,"ax"
48 #define old_len 141b-140b
49 #define new_len1 144f-143f
50 #define new_len2 145f-144f
53 * max without conditionals. Idea adapted from:
54 * http://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax
56 #define alt_max_short(a, b) ((a) ^ (((a) ^ (b)) & -(-((a) < (b)))))
58 .macro ALTERNATIVE_2 oldinstr, newinstr1, feature1, newinstr2, feature2
62 .skip -((alt_max_short(new_len1, new_len2) - (old_len)) > 0) * \
63 (alt_max_short(new_len1, new_len2) - (old_len)),0x90
66 .pushsection .altinstructions,"a"
67 altinstruction_entry 140b,143f,\feature1,142b-140b,144f-143f,142b-141b
68 altinstruction_entry 140b,144f,\feature2,142b-140b,145f-144f,142b-141b
71 .pushsection .altinstr_replacement,"ax"
80 #endif /* __ASSEMBLY__ */
82 #endif /* _ASM_X86_ALTERNATIVE_ASM_H */