x86, alternative: Add header guards to <asm/alternative-asm.h>
[pandora-kernel.git] / arch / x86 / include / asm / alternative-asm.h
1 #ifndef _ASM_X86_ALTERNATIVE_ASM_H
2 #define _ASM_X86_ALTERNATIVE_ASM_H
3
4 #ifdef __ASSEMBLY__
5
6 #include <asm/asm.h>
7
8 #ifdef CONFIG_SMP
9         .macro LOCK_PREFIX
10 1:      lock
11         .section .smp_locks,"a"
12         .balign 4
13         .long 1b - .
14         .previous
15         .endm
16 #else
17         .macro LOCK_PREFIX
18         .endm
19 #endif
20
21 .macro altinstruction_entry orig alt feature orig_len alt_len pad_len
22         .long \orig - .
23         .long \alt - .
24         .word \feature
25         .byte \orig_len
26         .byte \alt_len
27         .byte \pad_len
28 .endm
29
30 .macro ALTERNATIVE oldinstr, newinstr, feature
31 140:
32         \oldinstr
33 141:
34         .skip -(((144f-143f)-(141b-140b)) > 0) * ((144f-143f)-(141b-140b)),0x90
35 142:
36
37         .pushsection .altinstructions,"a"
38         altinstruction_entry 140b,143f,\feature,142b-140b,144f-143f,142b-141b
39         .popsection
40
41         .pushsection .altinstr_replacement,"ax"
42 143:
43         \newinstr
44 144:
45         .popsection
46 .endm
47
48 .macro ALTERNATIVE_2 oldinstr, newinstr1, feature1, newinstr2, feature2
49 140:
50         \oldinstr
51 141:
52         .skip -(((144f-143f)-(141b-140b)) > 0) * ((144f-143f)-(141b-140b)),0x90
53         .skip -(((145f-144f)-(144f-143f)-(141b-140b)) > 0) * ((145f-144f)-(144f-143f)-(141b-140b)),0x90
54 142:
55
56         .pushsection .altinstructions,"a"
57         altinstruction_entry 140b,143f,\feature1,142b-140b,144f-143f,142b-141b
58         altinstruction_entry 140b,144f,\feature2,142b-140b,145f-144f,142b-141b
59         .popsection
60
61         .pushsection .altinstr_replacement,"ax"
62 143:
63         \newinstr1
64 144:
65         \newinstr2
66 145:
67         .popsection
68 .endm
69
70 #endif  /*  __ASSEMBLY__  */
71
72 #endif /* _ASM_X86_ALTERNATIVE_ASM_H */