From 260e85cd07135c4d7ab2696ac1cc8212e092ecdb Mon Sep 17 00:00:00 2001 From: Aseda Aboagye Date: Thu, 15 Oct 2015 18:27:41 -0700 Subject: system: Copy the loader lastly before jumping. The point at which we reloaded the loader was too early. When items are placed into .bss.slow via CONFIG_REPLACE_LOADER_WITH_BSS_SLOW, other tasks could still access their variables that may have been in that region after we had replaced those contents with the loader. This commit moves the reloading of the loader to as late as possible once all tasks have done their HOOK_SYSJUMP work. Also, fixed a bug with the .bss.slow section. If a board is not using the config option but items are placed in that section, that part of RAM would not be cleared out. BUG=chrome-os-partner:46056 BRANCH=None TEST=Enable config option on GLaDOS and add a few variables to the .bss.slow section. 'sysjump' between RO and RW and verify that no data bus error is encountered. TEST=make -j buildall tests Change-Id: I3084700b9d5c144e86e2e408b72d2e3075a67413 Signed-off-by: Aseda Aboagye Reviewed-on: https://chromium-review.googlesource.com/306173 Commit-Ready: Aseda Aboagye Tested-by: Aseda Aboagye Reviewed-by: Randall Spangler --- core/cortex-m/ec.lds.S | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'core/cortex-m') diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S index f778ca8f88..9fe53747b2 100644 --- a/core/cortex-m/ec.lds.S +++ b/core/cortex-m/ec.lds.S @@ -223,8 +223,10 @@ SECTIONS *(.bss.system_stack) /* Rest of .bss takes care of its own alignment */ *(.bss) +#ifdef CONFIG_REPLACE_LOADER_WITH_BSS_SLOW . = ALIGN(4); __bss_end = .; +#endif /* defined(CONFIG_REPLACE_LOADER_WITH_BSS_SLOW) */ } > IRAM .bss.slow : { @@ -233,6 +235,12 @@ SECTIONS #ifdef CONFIG_REPLACE_LOADER_WITH_BSS_SLOW } > LDR_REGION #else + /* + * Not replacing the loader, so .bss.slow is part of .bss. It needs to + * be followed by __bss_end so that .bss.slow will be zeroed by init. + */ + . = ALIGN(4); + __bss_end = .; } > IRAM #endif /* defined(CONFIG_REPLACE_LOADER_WITH_BSS_SLOW) */ -- cgit v1.2.1