diff options
Diffstat (limited to 'arch/powerpc/include/asm/code-patching.h')
-rw-r--r-- | arch/powerpc/include/asm/code-patching.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h index 840a5509b3f1..994c60a857ce 100644 --- a/arch/powerpc/include/asm/code-patching.h +++ b/arch/powerpc/include/asm/code-patching.h | |||
@@ -99,4 +99,25 @@ static inline unsigned long ppc_global_function_entry(void *func) | |||
99 | #endif | 99 | #endif |
100 | } | 100 | } |
101 | 101 | ||
102 | #ifdef CONFIG_PPC64 | ||
103 | /* | ||
104 | * Some instruction encodings commonly used in dynamic ftracing | ||
105 | * and function live patching. | ||
106 | */ | ||
107 | |||
108 | /* This must match the definition of STK_GOT in <asm/ppc_asm.h> */ | ||
109 | #if defined(_CALL_ELF) && _CALL_ELF == 2 | ||
110 | #define R2_STACK_OFFSET 24 | ||
111 | #else | ||
112 | #define R2_STACK_OFFSET 40 | ||
113 | #endif | ||
114 | |||
115 | #define PPC_INST_LD_TOC (PPC_INST_LD | ___PPC_RT(__REG_R2) | \ | ||
116 | ___PPC_RA(__REG_R1) | R2_STACK_OFFSET) | ||
117 | |||
118 | /* usually preceded by a mflr r0 */ | ||
119 | #define PPC_INST_STD_LR (PPC_INST_STD | ___PPC_RS(__REG_R0) | \ | ||
120 | ___PPC_RA(__REG_R1) | PPC_LR_STKOFF) | ||
121 | #endif /* CONFIG_PPC64 */ | ||
122 | |||
102 | #endif /* _ASM_POWERPC_CODE_PATCHING_H */ | 123 | #endif /* _ASM_POWERPC_CODE_PATCHING_H */ |