[coreboot-gerrit] New patch to review for coreboot: emulation/i440fx: set %esp to 0xa0000 so very large ramstages will work.

Ronald G. Minnich (rminnich@gmail.com) gerrit at coreboot.org
Wed Jun 15 18:20:51 CEST 2016


Ronald G. Minnich (rminnich at gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15201

-gerrit

commit 710fc2b848ed7aad234b5bea817af148d2f05129
Author: Ronald G. Minnich <rminnich at gmail.com>
Date:   Tue Jun 14 13:18:10 2016 -0700

    emulation/i440fx: set %esp to 0xa0000 so very large ramstages will work.
    
    cache_as_ram.inc for emulation/qemu-i440fx was setting the
    stack to CONFIG_RAMTOP for the copy_and_run stage.
    This value failed for very large ramstages because we
    overwrote the stack with the ramstage.
    
    In general, payloads won't use anything below 1M, and the romstage on
    this target already uses 0xdxxxx for the stack. 0xa0000 seems a good
    choice since should we pop too much qemu will exit quickly.
    
    I ran this by Gerd Hoffman and he feels it's a reasonable value.
    
    Change-Id: I065b39af9cd49f75221a2f436f445b2380d1806b
    Signed-off-by: Ronald G. Minnich <rminnich at gmail.com>
---
 src/Kconfig                                          | 2 +-
 src/mainboard/emulation/qemu-i440fx/cache_as_ram.inc | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/Kconfig b/src/Kconfig
index 4eda537..9235598 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -471,7 +471,7 @@ config TPM
 
 config RAMTOP
 	hex
-	default 0x200000
+	default 0x1000000
 	depends on ARCH_X86
 
 config HEAP_SIZE
diff --git a/src/mainboard/emulation/qemu-i440fx/cache_as_ram.inc b/src/mainboard/emulation/qemu-i440fx/cache_as_ram.inc
index fcd2d3b..675b6f0 100644
--- a/src/mainboard/emulation/qemu-i440fx/cache_as_ram.inc
+++ b/src/mainboard/emulation/qemu-i440fx/cache_as_ram.inc
@@ -58,7 +58,12 @@ __main:
 	post_code(POST_PREPARE_RAMSTAGE)
 	cld			/* Clear direction flag. */
 
-	movl	$CONFIG_RAMTOP, %esp
+	/* Set the (pre-decremented) %esp to a value that will
+	 * cause qemu to kill us if we ever pop too much. This
+	 * value also gets the copy_and_run stack out of the way
+	 * of big ramstages. The ramstage will load its own %esp
+	 * so there is no harm in using this value. */
+	movl	$0xa0000, %esp
 	movl	%esp, %ebp
 	call	copy_and_run
 



More information about the coreboot-gerrit mailing list