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

Milton D. Miller II miltonm at realtime.net
Tue Aug 30 15:47:53 EST 2005


Michael Ellerman wrote:

>
> 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()
>   */

1) its not necessarly from prom_init

2) its not returned, its a parameter on the new call.


I think this code would be clearer if we moved the call to prom_init
to be the straight path (reversed the sense of the initial compare to
r5) and have a "we skip to after the trap branch" for the kexec/other
non-prom callback bootloader case.   

Somewhere I have a patch to do that, buried in a tree mixed with
something else most likely.

milton

>  _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