1#ifndef __ASM_ALTERNATIVE_ASM_H 2#define __ASM_ALTERNATIVE_ASM_H 3 4#ifdef __ASSEMBLY__ 5 6.macro altinstruction_entry orig_offset alt_offset feature orig_len alt_len 7 .word \orig_offset - . 8 .word \alt_offset - . 9 .hword \feature 10 .byte \orig_len 11 .byte \alt_len 12.endm 13 14.macro alternative_insn insn1 insn2 cap 15661: \insn1 16662: .pushsection .altinstructions, "a" 17 altinstruction_entry 661b, 663f, \cap, 662b-661b, 664f-663f 18 .popsection 19 .pushsection .altinstr_replacement, "ax" 20663: \insn2 21664: .popsection 22 .if ((664b-663b) != (662b-661b)) 23 .error "Alternatives instruction length mismatch" 24 .endif 25.endm 26 27#endif /* __ASSEMBLY__ */ 28 29#endif /* __ASM_ALTERNATIVE_ASM_H */ 30