Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __ASM_ALTERNATIVE_H
0003 #define __ASM_ALTERNATIVE_H
0004 
0005 #include <asm/alternative-macros.h>
0006 
0007 #ifndef __ASSEMBLY__
0008 
0009 #include <linux/init.h>
0010 #include <linux/types.h>
0011 #include <linux/stddef.h>
0012 
0013 struct alt_instr {
0014     s32 orig_offset;    /* offset to original instruction */
0015     s32 alt_offset;     /* offset to replacement instruction */
0016     u16 cpufeature;     /* cpufeature bit set for replacement */
0017     u8  orig_len;       /* size of original instruction(s) */
0018     u8  alt_len;        /* size of new instruction(s), <= orig_len */
0019 };
0020 
0021 typedef void (*alternative_cb_t)(struct alt_instr *alt,
0022                  __le32 *origptr, __le32 *updptr, int nr_inst);
0023 
0024 void __init apply_boot_alternatives(void);
0025 void __init apply_alternatives_all(void);
0026 bool alternative_is_applied(u16 cpufeature);
0027 
0028 #ifdef CONFIG_MODULES
0029 void apply_alternatives_module(void *start, size_t length);
0030 #else
0031 static inline void apply_alternatives_module(void *start, size_t length) { }
0032 #endif
0033 
0034 #endif /* __ASSEMBLY__ */
0035 #endif /* __ASM_ALTERNATIVE_H */