From 758ef07150359389288f32c86cabfb069fad266b Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Thu, 11 Feb 2016 15:19:48 -0800 Subject: [PATCH] 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 Reviewed-on: https://chromium-review.googlesource.com/327413 Reviewed-by: Marius Schilder --- chip/g/loader/launch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chip/g/loader/launch.c b/chip/g/loader/launch.c index 56314bb46b..54edc84268 100644 --- a/chip/g/loader/launch.c +++ b/chip/g/loader/launch.c @@ -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]);