[coreboot-gerrit] New patch to review for coreboot: 504fb0a x86: don't clear bss in ramstage entry

Aaron Durbin (adurbin@google.com) gerrit at coreboot.org
Wed Mar 20 20:00:16 CET 2013


Aaron Durbin (adurbin at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2865

-gerrit

commit 504fb0ae5384f1b38a95b0bf4aae2cc393a36435
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Wed Mar 20 13:49:27 2013 -0500

    x86: don't clear bss in ramstage entry
    
    The cbfs stage loading routine already zeros out the full
    memory region that a stage will be loaded. Therefore, it is
    unnecessary to to clear the bss again after once ramstage starts.
    
    Change-Id: Icc7021329dbf59bef948a41606f56746f21b507f
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
---
 src/arch/x86/lib/c_start.S | 11 -----------
 src/lib/cbfs.c             |  1 +
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/src/arch/x86/lib/c_start.S b/src/arch/x86/lib/c_start.S
index 295283b..35bc26b 100644
--- a/src/arch/x86/lib/c_start.S
+++ b/src/arch/x86/lib/c_start.S
@@ -29,17 +29,6 @@ _start:
 
 	cld
 
-	/** clear bss, which unlike the stack is zero by definition */
-	leal	_bss, %edi
-	movl	$_ebss, %ecx
-	subl	%edi, %ecx
-	jz	.Lnobss
-	shrl	$2, %ecx  /* it is 32 bit aligned, right? */
-	xorl	%eax, %eax
-	rep
-	stosl
-.Lnobss:
-
 	/** poison the stack. Code should not count on the
 	 * stack being full of zeros. This stack poisoning
 	 * recently uncovered a bug in the broadcast SIPI
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index abb95ab..c56f550 100644
--- a/src/lib/cbfs.c
+++ b/src/lib/cbfs.c
@@ -129,6 +129,7 @@ void * cbfs_load_stage(struct cbfs_media *media, const char *name)
 			name,
 			(uint32_t) stage->load, stage->memlen,
 			stage->entry);
+	/* Stages rely the below clearing so that the bss is initialized. */
 	memset((void *) (uint32_t) stage->load, 0, stage->memlen);
 
 	if (cbfs_decompress(stage->compression,



More information about the coreboot-gerrit mailing list