Libpayload needs to clear the bss region.
authorMarc Jones <marcj303@gmail.com>
Tue, 28 Jun 2011 20:30:05 +0000 (14:30 -0600)
committerMarc Jones <marcj303@gmail.com>
Wed, 29 Jun 2011 01:31:04 +0000 (03:31 +0200)
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@gmail.com>
Reviewed-on: http://review.coreboot.org/66
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
payloads/libpayload/arch/i386/head.S

index db18a5195fc1be97aecf135a5196a672dda99837..88db4124d5627cca620419a8da4e16df44788cde 100644 (file)
@@ -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