Skip to content

Commit 4f18b9e

Browse files
npigginmpe
authored andcommitted
powerpc/64: Move initial base and TOC pointer calculation
A later change moves the non-prom case to run at the virtual address earlier, which calls for virtual TOC and kernel base. Split these two calculations for prom and non-prom to make that change simpler. Signed-off-by: Nicholas Piggin <[email protected]> [mpe: Retain relative_toc call for start_initialization_book3e] Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent 40f7b52 commit 4f18b9e

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

arch/powerpc/kernel/head_64.S

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -515,15 +515,6 @@ __start_initialization_multiplatform:
515515
/* Zero r13 (paca) so early program check / mce don't use it */
516516
li r13,0
517517

518-
/* Get TOC pointer (current runtime address) */
519-
bl relative_toc
520-
521-
/* find out where we are now */
522-
bcl 20,31,$+4
523-
0: mflr r26 /* r26 = runtime addr here */
524-
addis r26,r26,(_stext - 0b)@ha
525-
addi r26,r26,(_stext - 0b)@l /* current runtime base addr */
526-
527518
/*
528519
* Are we booted from a PROM Of-type client-interface ?
529520
*/
@@ -540,16 +531,38 @@ __start_initialization_multiplatform:
540531
mr r29,r9
541532
#endif
542533

534+
/* Get TOC pointer (current runtime address) */
535+
bl relative_toc
536+
543537
#ifdef CONFIG_PPC_BOOK3E_64
544538
bl start_initialization_book3e
545539
#else
546540
bl start_initialization_book3s
547541
#endif /* CONFIG_PPC_BOOK3E_64 */
542+
543+
/* Get TOC pointer */
544+
bl relative_toc
545+
546+
/* find out where we are now */
547+
bcl 20,31,$+4
548+
0: mflr r26 /* r26 = runtime addr here */
549+
addis r26,r26,(_stext - 0b)@ha
550+
addi r26,r26,(_stext - 0b)@l /* current runtime base addr */
551+
548552
b __after_prom_start
549553

550554
__REF
551555
__boot_from_prom:
552556
#ifdef CONFIG_PPC_OF_BOOT_TRAMPOLINE
557+
/* Get TOC pointer */
558+
bl relative_toc
559+
560+
/* find out where we are now */
561+
bcl 20,31,$+4
562+
0: mflr r26 /* r26 = runtime addr here */
563+
addis r26,r26,(_stext - 0b)@ha
564+
addi r26,r26,(_stext - 0b)@l /* current runtime base addr */
565+
553566
/* Save parameters */
554567
mr r31,r3
555568
mr r30,r4

0 commit comments

Comments
 (0)