Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_S390_ALTERNATIVE_ASM_H
0003 #define _ASM_S390_ALTERNATIVE_ASM_H
0004 
0005 #ifdef __ASSEMBLY__
0006 
0007 /*
0008  * Issue one struct alt_instr descriptor entry (need to put it into
0009  * the section .altinstructions, see below). This entry contains
0010  * enough information for the alternatives patching code to patch an
0011  * instruction. See apply_alternatives().
0012  */
0013 .macro alt_entry orig_start, orig_end, alt_start, alt_end, feature
0014     .long   \orig_start - .
0015     .long   \alt_start - .
0016     .word   \feature
0017     .byte   \orig_end - \orig_start
0018     .org    . - ( \orig_end - \orig_start ) + ( \alt_end - \alt_start )
0019     .org    . - ( \alt_end - \alt_start ) + ( \orig_end - \orig_start )
0020 .endm
0021 
0022 /*
0023  * Define an alternative between two instructions. If @feature is
0024  * present, early code in apply_alternatives() replaces @oldinstr with
0025  * @newinstr.
0026  */
0027 .macro ALTERNATIVE oldinstr, newinstr, feature
0028     .pushsection .altinstr_replacement,"ax"
0029 770:    \newinstr
0030 771:    .popsection
0031 772:    \oldinstr
0032 773:    .pushsection .altinstructions,"a"
0033     alt_entry 772b, 773b, 770b, 771b, \feature
0034     .popsection
0035 .endm
0036 
0037 /*
0038  * Define an alternative between two instructions. If @feature is
0039  * present, early code in apply_alternatives() replaces @oldinstr with
0040  * @newinstr.
0041  */
0042 .macro ALTERNATIVE_2 oldinstr, newinstr1, feature1, newinstr2, feature2
0043     .pushsection .altinstr_replacement,"ax"
0044 770:    \newinstr1
0045 771:    \newinstr2
0046 772:    .popsection
0047 773:    \oldinstr
0048 774:    .pushsection .altinstructions,"a"
0049     alt_entry 773b, 774b, 770b, 771b,\feature1
0050     alt_entry 773b, 774b, 771b, 772b,\feature2
0051     .popsection
0052 .endm
0053 
0054 #endif  /*  __ASSEMBLY__  */
0055 
0056 #endif /* _ASM_S390_ALTERNATIVE_ASM_H */