cr50: write protect area where the code jumps to

The launcher should explicitly disable writes to the code space where
the loaded code is going to be running from.

BRANCH=None
BUG=chrome-os-partner:37554
TEST=with the rest of the patches applied firmware updates work as
     expected.

Change-Id: I744f7016e4427188f53e8fa3302e8c06cf836e2e
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/327413
Reviewed-by: Marius Schilder <mschilder@chromium.org>
This commit is contained in:
Vadim Bendebury
2016-02-11 15:19:48 -08:00
committed by chrome-bot
parent a0ee706819
commit 758ef07150

View File

@@ -221,11 +221,12 @@ void tryLaunch(uint32_t adr, size_t max_size)
GREG32(GLOBALSEC, FLASH_REGION1_SIZE) = hdr->image_size - 1;
GWRITE_FIELD(GLOBALSEC, FLASH_REGION1_CTRL, EN, 1);
GWRITE_FIELD(GLOBALSEC, FLASH_REGION1_CTRL, RD_EN, 1);
GWRITE_FIELD(GLOBALSEC, FLASH_REGION1_CTRL, WR_EN, 0);
/* TODO: lock FLASH_REGION 1? */
disarmRAMGuards();
debug_printf("Valid image found at 0x%08x, jumping\n", hdr);
debug_printf("Valid image found at 0x%08x, jumping", hdr);
uart_tx_flush();
_jump_to_address(&hdr[1]);