[PATCH 2/12] ppc64: Fixup __after_prom_start to use phys address returned from prom_init()

Michael Ellerman michael at ellerman.id.au
Fri Aug 26 12:53:21 EST 2005


This patch removes a FIXME in head.S. prom_init() calculates the physical
address of __start and passes it to the kernel, however currently the code
ignores this value and recalculates.

So instead just use the value provided by prom_init().

Signed-off-by: Michael Ellerman <michael at ellerman.id.au>
---

 arch/ppc64/kernel/head.S |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

Index: work/arch/ppc64/kernel/head.S
===================================================================
--- work.orig/arch/ppc64/kernel/head.S
+++ work/arch/ppc64/kernel/head.S
@@ -1441,8 +1441,8 @@ _STATIC(__boot_from_prom)
 	trap
 
 /*
- * At this point, r3 contains the physical address we are running at,
- * returned by prom_init()
+ * At this point, r30 contains the physical address of __start, returned
+ * by prom_init()
  */
 _STATIC(__after_prom_start)
 
@@ -1458,17 +1458,11 @@ _STATIC(__after_prom_start)
  *	r26 == relocation offset
  *	r27 == KERNELBASE
  */
-	bl	.reloc_offset
-	mr	r26,r3
 	SET_REG_TO_CONST(r27,KERNELBASE)
 
 	li	r3,0			/* target addr */
 
-	// XXX FIXME: Use phys returned by OF (r30)
-	sub	r4,r27,r26 		/* source addr			 */
-					/* current address of _start	 */
-					/*   i.e. where we are running	 */
-					/*	the source addr		 */
+	mr	r4,r30			/* source, current addr of __start */
 
 	LOADADDR(r5,copy_to_here)	/* # bytes of memory to copy	 */
 	sub	r5,r5,r27
@@ -1485,7 +1479,8 @@ _STATIC(__after_prom_start)
 	bctr
 
 4:	LOADADDR(r5,klimit)
-	sub	r5,r5,r26
+	sub	r5,r5,r27		/* subtract KERNELBASE */
+	add	r5,r5,r30		/* add physical offset to __start */
 	ld	r5,0(r5)		/* get the value of klimit */
 	sub	r5,r5,r27
 	bl	.copy_and_flush		/* copy the rest */



More information about the Linuxppc64-dev mailing list