[coreboot] New patch to review: cd3d80c Libpayload needs to clear the bss region.

Marc Jones (marcj303@gmail.com) gerrit at coreboot.org
Tue Jun 28 22:37:38 CEST 2011

Marc Jones (marcj303 at gmail.com) just uploaded a new patch set to gerrit, which you can find at


commit cd3d80c3e6c6c4b3de63802ddab280da3c96e975
Author: Marc Jones <marcj303 at gmail.com>
Date:   Tue Jun 28 14:30:05 2011 -0600

    Libpayload needs to clear the bss region.
    Libpayload shouldn't count on coreboot or other payloads to clear memory. This fixes problems with payloads being loaded after or on top of each other.
    Change-Id: I30303d47e465e8921f47acab667c7998ba79fca7
    Signed-off-by: Marc Jones <marcj303 at gmail.com>
 payloads/libpayload/arch/i386/head.S |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/payloads/libpayload/arch/i386/head.S b/payloads/libpayload/arch/i386/head.S
index db18a51..88db412 100644
--- a/payloads/libpayload/arch/i386/head.S
+++ b/payloads/libpayload/arch/i386/head.S
@@ -70,10 +70,17 @@ _init:
 	movl %esp, %esi
 	/* Store EAX and EBX */
 	movl %eax,loader_eax
 	movl %ebx,loader_ebx
+	/* Clear the bss */
+	cld
+	movl $.bss, %edi
+	movl $_end, %ecx
+	subl %edi, %ecx
+	xor %ax, %ax
+	rep stosb
 	/* Setup new stack. */
 	movl $_stack, %ebx

More information about the coreboot mailing list