arch/parisc/include/asm/alternative.h

Source file repositories/reference/linux-study-clean/arch/parisc/include/asm/alternative.h

File Facts

System
Linux kernel
Corpus path
arch/parisc/include/asm/alternative.h
Extension
.h
Size
2062 bytes
Lines
67
Domain
Architecture Layer
Bucket
arch/parisc
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

struct alt_instr {
	s32 orig_offset;	/* offset to original instructions */
	s16 len;		/* end of original instructions */
	u16 cond;		/* see ALT_COND_XXX */
	u32 replacement;	/* replacement instruction or code */
} __packed;

void set_kernel_text_rw(int enable_read_write);
void apply_alternatives_all(void);
void apply_alternatives(struct alt_instr *start, struct alt_instr *end,
	const char *module_name);

/* Alternative SMP implementation. */
#define ALTERNATIVE(cond, replacement)		"!0:"	\
	".section .altinstructions, \"a\"	!"	\
	".align 4				!"	\
	".word (0b-4-.)				!"	\
	".hword 1, " __stringify(cond) "	!"	\
	".word " __stringify(replacement) "	!"	\
	".previous"

#else

/* to replace one single instructions by a new instruction */
#define ALTERNATIVE(from, to, cond, replacement)\
	.section .altinstructions, "a"	!	\
	.align 4			!	\
	.word (from - .)		!	\
	.hword (to - from)/4, cond	!	\
	.word replacement		!	\
	.previous

/* to replace multiple instructions by new code */
#define ALTERNATIVE_CODE(from, num_instructions, cond, new_instr_ptr)\
	.section .altinstructions, "a"	!	\
	.align 4			!	\
	.word (from - .)		!	\
	.hword -num_instructions, cond	!	\
	.word (new_instr_ptr - .)	!	\
	.previous

#endif  /*  __ASSEMBLER__  */

#endif /* __ASM_PARISC_ALTERNATIVE_H */

Annotation

Implementation Notes