Skip to content

Commit 3d635ab

Browse files
amodrampe
authored andcommitted
powerpc/boot: Make use of REL16 relocs in powerpc/boot/util.S
Use bcl 20,31,0f rather than plain bl to avoid unbalancing the link stack. Update the code to use REL16 relocs, available for ppc64 in 2009 (and ppc32 in 2005). Signed-off-by: Alan Modra <[email protected]> [mpe: Incorporate more detail into the change log] Signed-off-by: Michael Ellerman <[email protected]>
1 parent f47462c commit 3d635ab

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

arch/powerpc/boot/util.S

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,11 @@ udelay:
4242
* (nanoseconds + (timebase_period_ns - 1 )) / timebase_period_ns
4343
* timebase_period_ns defaults to 60 (16.6MHz) */
4444
mflr r5
45-
bl 0f
45+
bcl 20,31,0f
4646
0: mflr r6
4747
mtlr r5
48-
lis r5,0b@ha
49-
addi r5,r5,0b@l
50-
subf r5,r5,r6 /* In case we're relocated */
51-
addis r5,r5,timebase_period_ns@ha
52-
lwz r5,timebase_period_ns@l(r5)
48+
addis r5,r6,(timebase_period_ns-0b)@ha
49+
lwz r5,(timebase_period_ns-0b)@l(r5)
5350
add r4,r4,r5
5451
addi r4,r4,-1
5552
divw r4,r4,r5 /* BUS ticks */

0 commit comments

Comments
 (0)