summaryrefslogtreecommitdiffstats
path: root/src/lib/asan.c
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2021-05-29 08:10:49 +0200
committerFelix Held <felix-coreboot@felixheld.de>2023-11-09 13:20:18 +0000
commita2bc2540c2d004b475b401ccf0b162c2452857bb (patch)
tree902284670b43d9e06d7dccc64dbeec24073fca4e /src/lib/asan.c
parent4ce52f622ed7fbac4bf5545fd7d39256203cdefe (diff)
downloadcoreboot-a2bc2540c2d004b475b401ccf0b162c2452857bb.tar.gz
coreboot-a2bc2540c2d004b475b401ccf0b162c2452857bb.tar.bz2
coreboot-a2bc2540c2d004b475b401ccf0b162c2452857bb.zip
Allow to build romstage sources inside the bootblock
Having a separate romstage is only desirable: - with advanced setups like vboot or normal/fallback - boot medium is slow at startup (some ARM SOCs) - bootblock is limited in size (Intel APL 32K) When this is not the case there is no need for the extra complexity that romstage brings. Including the romstage sources inside the bootblock substantially reduces the total code footprint. Often the resulting code is 10-20k smaller. This is controlled via a Kconfig option. TESTED: works on qemu x86, arm and aarch64 with and without VBOOT. Change-Id: Id68390edc1ba228b121cca89b80c64a92553e284 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55068 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src/lib/asan.c')
-rw-r--r--src/lib/asan.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/asan.c b/src/lib/asan.c
index 9493b3b51ac7..8f92d5a75900 100644
--- a/src/lib/asan.c
+++ b/src/lib/asan.c
@@ -16,7 +16,7 @@
static inline void *asan_mem_to_shadow(const void *addr)
{
-#if ENV_ROMSTAGE
+#if ENV_SEPARATE_ROMSTAGE
return (void *)((uintptr_t)&_asan_shadow + (((uintptr_t)addr -
(uintptr_t)&_car_region_start) >> ASAN_SHADOW_SCALE_SHIFT));
#elif ENV_RAMSTAGE
@@ -27,7 +27,7 @@ static inline void *asan_mem_to_shadow(const void *addr)
static inline const void *asan_shadow_to_mem(const void *shadow_addr)
{
-#if ENV_ROMSTAGE
+#if ENV_SEPARATE_ROMSTAGE
return (void *)((uintptr_t)&_car_region_start + (((uintptr_t)shadow_addr -
(uintptr_t)&_asan_shadow) << ASAN_SHADOW_SCALE_SHIFT));
#elif ENV_RAMSTAGE
@@ -237,7 +237,7 @@ static __always_inline void check_memory_region_inline(unsigned long addr,
size_t size, bool write,
unsigned long ret_ip)
{
-#if ENV_ROMSTAGE
+#if ENV_SEPARATE_ROMSTAGE
if (((uintptr_t)addr < (uintptr_t)&_car_region_start) ||
((uintptr_t)addr > (uintptr_t)&_ebss))
return;
@@ -269,7 +269,7 @@ void check_memory_region(unsigned long addr, size_t size, bool write,
uintptr_t __asan_shadow_offset(uintptr_t addr)
{
-#if ENV_ROMSTAGE
+#if ENV_SEPARATE_ROMSTAGE
return (uintptr_t)&_asan_shadow - (((uintptr_t)&_car_region_start) >>
ASAN_SHADOW_SCALE_SHIFT);
#elif ENV_RAMSTAGE
@@ -323,7 +323,7 @@ static void asan_ctors(void)
void asan_init(void)
{
-#if ENV_ROMSTAGE
+#if ENV_SEPARATE_ROMSTAGE
size_t size = (size_t)&_ebss - (size_t)&_car_region_start;
asan_unpoison_shadow((void *)&_car_region_start, size);
#elif ENV_RAMSTAGE