Path: blob/master/arch/parisc/include/asm/alternative.h
26298 views
/* SPDX-License-Identifier: GPL-2.0 */1#ifndef __ASM_PARISC_ALTERNATIVE_H2#define __ASM_PARISC_ALTERNATIVE_H34#define ALT_COND_ALWAYS 0x80 /* always replace instruction */5#define ALT_COND_NO_SMP 0x01 /* when running UP instead of SMP */6#define ALT_COND_NO_DCACHE 0x02 /* if system has no d-cache */7#define ALT_COND_NO_ICACHE 0x04 /* if system has no i-cache */8#define ALT_COND_NO_SPLIT_TLB 0x08 /* if split_tlb == 0 */9#define ALT_COND_NO_IOC_FDC 0x10 /* if I/O cache does not need flushes */10#define ALT_COND_RUN_ON_QEMU 0x20 /* if running on QEMU */1112#define INSN_PxTLB 0x02 /* modify pdtlb, pitlb */13#define INSN_NOP 0x08000240 /* nop */1415#ifndef __ASSEMBLER__1617#include <linux/init.h>18#include <linux/types.h>19#include <linux/stddef.h>20#include <linux/stringify.h>2122struct alt_instr {23s32 orig_offset; /* offset to original instructions */24s16 len; /* end of original instructions */25u16 cond; /* see ALT_COND_XXX */26u32 replacement; /* replacement instruction or code */27} __packed;2829void set_kernel_text_rw(int enable_read_write);30void apply_alternatives_all(void);31void apply_alternatives(struct alt_instr *start, struct alt_instr *end,32const char *module_name);3334/* Alternative SMP implementation. */35#define ALTERNATIVE(cond, replacement) "!0:" \36".section .altinstructions, \"a\" !" \37".align 4 !" \38".word (0b-4-.) !" \39".hword 1, " __stringify(cond) " !" \40".word " __stringify(replacement) " !" \41".previous"4243#else4445/* to replace one single instructions by a new instruction */46#define ALTERNATIVE(from, to, cond, replacement)\47.section .altinstructions, "a" ! \48.align 4 ! \49.word (from - .) ! \50.hword (to - from)/4, cond ! \51.word replacement ! \52.previous5354/* to replace multiple instructions by new code */55#define ALTERNATIVE_CODE(from, num_instructions, cond, new_instr_ptr)\56.section .altinstructions, "a" ! \57.align 4 ! \58.word (from - .) ! \59.hword -num_instructions, cond ! \60.word (new_instr_ptr - .) ! \61.previous6263#endif /* __ASSEMBLER__ */6465#endif /* __ASM_PARISC_ALTERNATIVE_H */666768