[PATCH] powerpc: Fixed the bug of duplicate copying
From: Jinglin Wen
Date: Thu Jun 06 2024 - 09:25:00 EST
Fixed the issue where the kernel, when booting from address 0, had
code incorrectly duplicated to address 0.
Signed-off-by: Jinglin Wen <jinglin.wen@xxxxxxxxxxxx>
---
arch/powerpc/kernel/head_64.S | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 4690c219bfa4..6c73551bdc50 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -647,7 +647,9 @@ __after_prom_start:
* Note: This process overwrites the OF exception vectors.
*/
LOAD_REG_IMMEDIATE(r3, PAGE_OFFSET)
- mr. r4,r26 /* In some cases the loader may */
+ tophys(r4,r26)
+ cmplwi cr0,r4,0 /* runtime base addr is zero */
+ mr r4,r26 /* In some cases the loader may */
beq 9f /* have already put us at zero */
li r6,0x100 /* Start offset, the first 0x100 */
/* bytes were copied earlier. */
--
2.25.1