diff options
author | Gabe Black <gabeblack@chromium.org> | 2012-01-15 06:54:59 -0800 |
---|---|---|
committer | Gabe Black (Do Not Use) <gabeblack@google.com> | 2012-01-18 20:55:47 -0800 |
commit | 29538919a8c0206c320162c061ce2511ea86e1e6 (patch) | |
tree | 12e0e7975c0a23d798bf1dd289479d477b998996 /common/cmd_vboot_twostop.c | |
parent | edc55109a42662c7e661070433b478f74ebb4165 (diff) |
X86: Don't assume U-Boot extends to the end of memory when wiping
On ARM, U-Boot is put at the end of memory, and the code that records the
unused areas of memory to be wiped uses the end of RAM as the upper bound
for the region occupied by U-Boot. On x86, U-Boot may have been relocated to
somewhere lower than the end of RAM because it can normally only address a 32
bit address space. This change makes the wiping code calculate where U-Boot
actually ends on x86 so the areas with large addresses will be wiped properly.
BUG=chrome-os-partner:7579
TEST=Built and booted on Lumpy, Stumpy, and Kaen. On Lumpy, verified that the
area with physical addresses above 4GB was now in the list to be wiped.
Change-Id: Ib7e0818e85daf512b76f85f4e68f88230d301cea
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/14223
Diffstat (limited to 'common/cmd_vboot_twostop.c')
-rw-r--r-- | common/cmd_vboot_twostop.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/common/cmd_vboot_twostop.c b/common/cmd_vboot_twostop.c index eb7d0c88b86..e1c33d72ea1 100644 --- a/common/cmd_vboot_twostop.c +++ b/common/cmd_vboot_twostop.c @@ -191,6 +191,9 @@ twostop_init_cparams(struct twostop_fmap *fmap, void *gbb, #if defined(CONFIG_OF_CONTROL) && defined(CONFIG_TEGRA2) +extern uint8_t _start; +extern uint8_t __bss_end__; + static void setup_arch_unused_memory(memory_wipe_t *wipe, crossystem_data_t *cdata, VbCommonParams *cparams) { @@ -227,6 +230,9 @@ static void setup_arch_unused_memory(memory_wipe_t *wipe, #elif defined(CONFIG_SYS_COREBOOT) +extern uint8_t __text_start; +extern uint8_t __bss_end; + static void setup_arch_unused_memory(memory_wipe_t *wipe, crossystem_data_t *cdata, VbCommonParams *cparams) { @@ -280,7 +286,13 @@ static void wipe_unused_memory(crossystem_data_t *cdata, setup_arch_unused_memory(&wipe, cdata, cparams); /* Exclude relocated u-boot structures. */ - memory_wipe_sub(&wipe, get_current_sp() - STACK_MARGIN, gd->ram_size); + memory_wipe_sub(&wipe, get_current_sp() - STACK_MARGIN, +#if defined(CONFIG_SYS_COREBOOT) + gd->relocaddr + (&__bss_end - &__text_start) +#elif defined(CONFIG_OF_CONTROL) && defined(CONFIG_TEGRA2) + gd->relocaddr + (&__bss_end__ - &_start) +#endif + ); /* Exclude the shared data between bootstub and main firmware. */ memory_wipe_sub(&wipe, (uintptr_t)cdata, |