All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH] Fix ppc4xx clear_bss() code
@ 2007-12-05 16:43 Anatolij Gustschin
  2007-12-05 18:42 ` Haavard Skinnemoen
  0 siblings, 1 reply; 3+ messages in thread
From: Anatolij Gustschin @ 2007-12-05 16:43 UTC (permalink / raw)
  To: u-boot

ppc4xx clear_bss() fails if BSS segment size is not
divisible by 4 without remainder. This patch provides
fix for this problem.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 cpu/ppc4xx/start.S |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/cpu/ppc4xx/start.S b/cpu/ppc4xx/start.S
index 9626b65..9175e31 100644
--- a/cpu/ppc4xx/start.S
+++ b/cpu/ppc4xx/start.S
@@ -1566,16 +1566,25 @@ clear_bss:
 	lwz	r4,GOT(_end)
 
 	cmplw	0, r3, r4
-	beq	6f
+	beq	7f
 
 	li	r0, 0
-5:
+
+	andi.	r5, r4, 3
+	beq	6f
+	sub	r4, r4, r5
+	mtctr	r5
+	mr	r5, r4
+5:	stb	r0, 0(r5)
+	addi	r5, r5, 1
+	bdnz	5b
+6:
 	stw	r0, 0(r3)
 	addi	r3, r3, 4
 	cmplw	0, r3, r4
-	bne	5b
-6:
+	bne	6b
 
+7:
 	mr	r3, r9		/* Init Data pointer		*/
 	mr	r4, r10		/* Destination Address		*/
 	bl	board_init_r
-- 
1.5.3.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot-Users] [PATCH] Fix ppc4xx clear_bss() code
  2007-12-05 16:43 [U-Boot-Users] [PATCH] Fix ppc4xx clear_bss() code Anatolij Gustschin
@ 2007-12-05 18:42 ` Haavard Skinnemoen
  2007-12-05 19:50   ` Wolfgang Denk
  0 siblings, 1 reply; 3+ messages in thread
From: Haavard Skinnemoen @ 2007-12-05 18:42 UTC (permalink / raw)
  To: u-boot

On Wed,  5 Dec 2007 17:43:20 +0100
agustschin at t-online.de (Anatolij Gustschin) wrote:

> ppc4xx clear_bss() fails if BSS segment size is not
> divisible by 4 without remainder. This patch provides
> fix for this problem.

Isn't it better to fix the linker script so that the size _is_
divisible by 4?

Haavard

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot-Users] [PATCH] Fix ppc4xx clear_bss() code
  2007-12-05 18:42 ` Haavard Skinnemoen
@ 2007-12-05 19:50   ` Wolfgang Denk
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfgang Denk @ 2007-12-05 19:50 UTC (permalink / raw)
  To: u-boot

In message <20071205194258.79f67211@siona> you wrote:
> 
> > ppc4xx clear_bss() fails if BSS segment size is not
> > divisible by 4 without remainder. This patch provides
> > fix for this problem.
> 
> Isn't it better to fix the linker script so that the size _is_
> divisible by 4?

From the robustness point of view Anatolij's patch is needed - it  is
a  desirable  feature of software to show correct behaviour even with
(slightly) wrong input.

ACKED.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
One essential to success is that you desire be an all-obsessing  one,
your thoughts and aims be co-ordinated, and your energy be concentra-
ted and applied without letup.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-12-05 19:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-05 16:43 [U-Boot-Users] [PATCH] Fix ppc4xx clear_bss() code Anatolij Gustschin
2007-12-05 18:42 ` Haavard Skinnemoen
2007-12-05 19:50   ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.