powerpc/64: Change the way relocation copy is calculated
authorNicholas Piggin <npiggin@gmail.com>
Wed, 28 Sep 2016 01:31:47 +0000 (11:31 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 4 Oct 2016 02:06:55 +0000 (13:06 +1100)
With a subsequent patch to put text into different sections,
(_end - _stext) can no longer be computed at link time to determine
the end of the copy. Instead, calculate it at runtime with
(copy_to_here - _stext) + (_end - copy_to_here).

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/head_64.S

index f765b0434731ceee350a069d3c924e5da57fef52..6e21812ee67232c2426e0e6df6b2d6b5d7524568 100644 (file)
@@ -628,11 +628,16 @@ __after_prom_start:
        bctr
 
 .balign 8
-p_end: .llong  _end - _stext
+p_end: .llong _end - copy_to_here
 
-4:     /* Now copy the rest of the kernel up to _end */
-       addis   r5,r26,(p_end - _stext)@ha
-       ld      r5,(p_end - _stext)@l(r5)       /* get _end */
+4:
+       /*
+        * Now copy the rest of the kernel up to _end, add
+        * _end - copy_to_here to the copy limit and run again.
+        */
+       addis   r8,r26,(p_end - _stext)@ha
+       ld      r8,(p_end - _stext)@l(r8)
+       add     r5,r5,r8
 5:     bl      copy_and_flush          /* copy the rest */
 
 9:     b       start_here_multiplatform