Thread (6 messages) 6 messages, 5 authors, 2021-03-14

Re: [PATCH] powerpc: Fix instruction encoding for lis in ppc_function_entry()

From: Christophe Leroy <hidden>
Date: 2021-03-05 11:37:55


Le 04/03/2021 à 03:04, Naveen N. Rao a écrit :
quoted hunk ↗ jump to hunk
'lis r2,N' is 'addis r2,0,N' and the instruction encoding in the macro
LIS_R2 is incorrect (it currently maps to 'addis 0,r2,N'). Fix the same.

Fixes: c71b7eff426fa7 ("powerpc: Add ABIv2 support to ppc_function_entry")
Reported-by: Jiri Olsa <redacted>
Signed-off-by: Naveen N. Rao <redacted>
---
  arch/powerpc/include/asm/code-patching.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h
index eacc9102c2515c..d5b3c3bb95b400 100644
--- a/arch/powerpc/include/asm/code-patching.h
+++ b/arch/powerpc/include/asm/code-patching.h
@@ -73,7 +73,7 @@ void __patch_exception(int exc, unsigned long addr);
  #endif
  
  #define OP_RT_RA_MASK	0xffff0000UL
-#define LIS_R2		0x3c020000UL
+#define LIS_R2		0x3c400000UL
  #define ADDIS_R2_R12	0x3c4c0000UL
  #define ADDI_R2_R2	0x38420000UL
That probably goes beyond the scope of this patch, but it would be more readable and less error 
prone to use macros defined in ppc-opcode.h just like kernel/module_64.c does for instance:

#define LIS_R2	(PPC_INST_ADDIS | __PPC_RT(R2))
#define ADDIS_R2_R12	(PPC_INST_ADDIS | __PPC_RT(R2) | __PPC_RA(R12))
#define ADDI_R2_R2	(PPC_INST_ADDI | __PPC_RT(R2) | __PPC_RA(R2))
  

base-commit: 91966823812efbd175f904599e5cf2a854b39809
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help