Commit | Line | Data |
---|---|---|
fba9eb79 MS |
1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | #ifndef _ASM_S390_ALTERNATIVE_ASM_H | |
3 | #define _ASM_S390_ALTERNATIVE_ASM_H | |
4 | ||
5 | #ifdef __ASSEMBLY__ | |
6 | ||
fba9eb79 MS |
7 | /* |
8 | * Issue one struct alt_instr descriptor entry (need to put it into | |
9 | * the section .altinstructions, see below). This entry contains | |
10 | * enough information for the alternatives patching code to patch an | |
11 | * instruction. See apply_alternatives(). | |
12 | */ | |
13 | .macro alt_entry orig_start, orig_end, alt_start, alt_end, feature | |
14 | .long \orig_start - . | |
15 | .long \alt_start - . | |
16 | .word \feature | |
17 | .byte \orig_end - \orig_start | |
207ddb91 | 18 | .org . - ( \orig_end - \orig_start ) & 1 |
e6ed91fd HC |
19 | .org . - ( \orig_end - \orig_start ) + ( \alt_end - \alt_start ) |
20 | .org . - ( \alt_end - \alt_start ) + ( \orig_end - \orig_start ) | |
fba9eb79 MS |
21 | .endm |
22 | ||
23 | /* | |
24 | * Define an alternative between two instructions. If @feature is | |
25 | * present, early code in apply_alternatives() replaces @oldinstr with | |
e6ed91fd | 26 | * @newinstr. |
fba9eb79 MS |
27 | */ |
28 | .macro ALTERNATIVE oldinstr, newinstr, feature | |
29 | .pushsection .altinstr_replacement,"ax" | |
30 | 770: \newinstr | |
31 | 771: .popsection | |
32 | 772: \oldinstr | |
e6ed91fd HC |
33 | 773: .pushsection .altinstructions,"a" |
34 | alt_entry 772b, 773b, 770b, 771b, \feature | |
fba9eb79 MS |
35 | .popsection |
36 | .endm | |
37 | ||
38 | /* | |
39 | * Define an alternative between two instructions. If @feature is | |
40 | * present, early code in apply_alternatives() replaces @oldinstr with | |
e6ed91fd | 41 | * @newinstr. |
fba9eb79 MS |
42 | */ |
43 | .macro ALTERNATIVE_2 oldinstr, newinstr1, feature1, newinstr2, feature2 | |
44 | .pushsection .altinstr_replacement,"ax" | |
45 | 770: \newinstr1 | |
46 | 771: \newinstr2 | |
47 | 772: .popsection | |
48 | 773: \oldinstr | |
e6ed91fd HC |
49 | 774: .pushsection .altinstructions,"a" |
50 | alt_entry 773b, 774b, 770b, 771b,\feature1 | |
51 | alt_entry 773b, 774b, 771b, 772b,\feature2 | |
fba9eb79 MS |
52 | .popsection |
53 | .endm | |
54 | ||
55 | #endif /* __ASSEMBLY__ */ | |
56 | ||
57 | #endif /* _ASM_S390_ALTERNATIVE_ASM_H */ |