Skip to content

Commit 7aed41c

Browse files
committed
powerpc/64s: Use symbolic macros for function entry encoding
In ppc_function_entry() we look for a specific set of instructions by masking the instructions and comparing with a known value. Currently those known values are just literal hex values, and we recently discovered one of them was wrong. Instead construct the values using the existing constants we have for defining various fields of instructions. Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Acked-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Link: https://lore.kernel.org/r/20210309071544.515303-1-mpe@ellerman.id.au
1 parent cea1531 commit 7aed41c

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

arch/powerpc/include/asm/code-patching.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ void __patch_exception(int exc, unsigned long addr);
7373
#endif
7474

7575
#define OP_RT_RA_MASK 0xffff0000UL
76-
#define LIS_R2 0x3c400000UL
77-
#define ADDIS_R2_R12 0x3c4c0000UL
78-
#define ADDI_R2_R2 0x38420000UL
76+
#define LIS_R2 (PPC_INST_ADDIS | __PPC_RT(R2))
77+
#define ADDIS_R2_R12 (PPC_INST_ADDIS | __PPC_RT(R2) | __PPC_RA(R12))
78+
#define ADDI_R2_R2 (PPC_INST_ADDI | __PPC_RT(R2) | __PPC_RA(R2))
79+
7980

8081
static inline unsigned long ppc_function_entry(void *func)
8182
{

0 commit comments

Comments
 (0)