Patchwork [U-Boot,2/6] powerpc/mpc85xx: modify the functionality clear_bss and the end address of the BSS

login
register
mail settings
Submitter ying.zhang@freescale.com
Date May 20, 2013, 6:07 a.m.
Message ID <1369030048-26130-2-git-send-email-ying.zhang@freescale.com>
Download mbox | patch
Permalink /patch/244844/
State Superseded
Delegated to: Andy Fleming
Headers show

Comments

ying.zhang@freescale.com - May 20, 2013, 6:07 a.m.
From: Ying Zhang <b40530@freescale.com>

There will clear the BSS in the function clear_bss(), the reset address of
the BSS started from the __bss_start, and increased by four-byte increments,
finally stoped depending on the address is equal to the _bss_end. If the end
address __bss_end is not alignment to 4byte, it will be an infinite loop.

1. The reset action stoped depending on the reset address is greater
than or equal the end address of the BSS.
2. The end address of the BSS should be 4byte aligned. Because the reset unit
is 4 Bytes.

This patch is on top of the patch "powerpc/mpc85xx: support application
without resetvec segment in the linker script".

Signed-off-by: Ying Zhang <b40530@freescale.com>
---
 arch/powerpc/cpu/mpc85xx/start.S        |    2 +-
 arch/powerpc/cpu/mpc85xx/u-boot-spl.lds |    6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)
Scott Wood - May 21, 2013, 7:37 p.m.
On 05/20/2013 01:07:24 AM, ying.zhang@freescale.com wrote:
> From: Ying Zhang <b40530@freescale.com>
> 
> There will clear the BSS in the function clear_bss(), the reset  
> address of
> the BSS started from the __bss_start, and increased by four-byte  
> increments,
> finally stoped depending on the address is equal to the _bss_end. If  
> the end
> address __bss_end is not alignment to 4byte, it will be an infinite  
> loop.
> 
> 1. The reset action stoped depending on the reset address is greater
> than or equal the end address of the BSS.
> 2. The end address of the BSS should be 4byte aligned. Because the  
> reset unit
> is 4 Bytes.

Should we add explicit alignment of the BSS start as well?

-Scott
Zhang Ying-B40530 - May 22, 2013, 1:57 a.m.
-----Original Message-----
From: Wood Scott-B07421 
Sent: Wednesday, May 22, 2013 3:38 AM
To: Zhang Ying-B40530
Cc: u-boot@lists.denx.de; afleming@gmail.com; Xie Xiaobo-R63061; Zhang Ying-B40530
Subject: Re: [PATCH 2/6] powerpc/mpc85xx: modify the functionality clear_bss and the end address of the BSS

On 05/20/2013 01:07:24 AM, ying.zhang@freescale.com wrote:
> From: Ying Zhang <b40530@freescale.com>
> 
> There will clear the BSS in the function clear_bss(), the reset  
> address of
> the BSS started from the __bss_start, and increased by four-byte  
> increments,
> finally stoped depending on the address is equal to the _bss_end. If  
> the end
> address __bss_end is not alignment to 4byte, it will be an infinite  
> loop.
> 
> 1. The reset action stoped depending on the reset address is greater
> than or equal the end address of the BSS.
> 2. The end address of the BSS should be 4byte aligned. Because the  
> reset unit
> is 4 Bytes.

Should we add explicit alignment of the BSS start as well?
[Zhang Ying]
That is better. I can add.

Patch

diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S
index 5542d0a..fb07938 100644
--- a/arch/powerpc/cpu/mpc85xx/start.S
+++ b/arch/powerpc/cpu/mpc85xx/start.S
@@ -1794,7 +1794,7 @@  clear_bss:
 	stw	r0,0(r3)
 	addi	r3,r3,4
 	cmplw	0,r3,r4
-	bne	5b
+	blt	5b
 6:
 
 	mr	r3,r9		/* Init Data pointer		*/
diff --git a/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds b/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds
index d595b89..55ff5e8 100644
--- a/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds
+++ b/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds
@@ -1,8 +1,5 @@ 
 /*
- * (C) Copyright 2006
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de
- *
- * Copyright 2009 Freescale Semiconductor, Inc.
+ * Copyright 2013 Freescale Semiconductor, Inc.
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -97,5 +94,6 @@  SECTIONS
 		*(.sbss*)
 		*(.bss*)
 	}
+	. = ALIGN(4);
 	__bss_end = .;
 }