diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2018-04-09 11:18:15 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-05-07 20:45:54 -0700 |
commit | 6e8cbe40eea777aeaeffe0fa0781a0a5d1763a4d (patch) | |
tree | d229d77bb060be8ba34d4bf94d257ac035c89c26 /common/vboot_hash.c | |
parent | c24d480d90699bf6aaf534d66dc48513d867bdd0 (diff) | |
download | chrome-ec-6e8cbe40eea777aeaeffe0fa0781a0a5d1763a4d.tar.gz |
shared_mem: Assert that shared memory size is large enough
We add a configuration option to set the minimum shared memory
size (CONFIG_SHAREDMEM_MINIMUM_SIZE), so that the link will fail
if there is not enough IRAM left.
Also, we add 2 macros around shared_mem_acquire, that check, at
build time, that the shared memory size is sufficient for the
allocation:
- SHARED_MEM_ACQUIRE_CHECK should be used instead of
shared_mem_acquire, when size is known in advance.
- SHARED_MEM_CHECK_SIZE should be used when only a maximum size
is known.
This does not account for "jump tags" that boards often add on
jump from RO to RW. Luckily, RW usually does not do verification,
and does not need as much shared memory.
BRANCH=none
BUG=chromium:739771
TEST=make buildall -j, no error
Change-Id: Ic4c72938affe65fe8f8bc17ee5111c1798fc536f
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1002713
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/vboot_hash.c')
-rw-r--r-- | common/vboot_hash.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/common/vboot_hash.c b/common/vboot_hash.c index e6b83aafe3..b7f0be32f2 100644 --- a/common/vboot_hash.c +++ b/common/vboot_hash.c @@ -34,6 +34,9 @@ struct vboot_hash_tag { #define CHUNK_SIZE 1024 /* Bytes to hash per deferred call */ #define WORK_INTERVAL_US 100 /* Delay between deferred calls */ +/* Check that CHUNK_SIZE fits in shared memory. */ +SHARED_MEM_CHECK_SIZE(CHUNK_SIZE); + static uint32_t data_offset; static uint32_t data_size; static uint32_t curr_pos; |