From d7892bc3913fab68c880d3b7a1206b4c23d5dbe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Fri, 28 Dec 2018 19:18:46 +0200 Subject: [PATCH] arch/x86: Add CAR stack location symbols MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add symbols for the non C_ENVIRONMENT_BOOTBLOCK builds and use them for stack guards. Change-Id: Ib622eacb161d9a110d35a7d6979d1b601503b6f4 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/30491 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans --- src/arch/x86/car.ld | 4 ++++ src/cpu/intel/car/romstage.c | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/arch/x86/car.ld b/src/arch/x86/car.ld index 86656829ab..2f0ce50e3c 100644 --- a/src/arch/x86/car.ld +++ b/src/arch/x86/car.ld @@ -86,6 +86,10 @@ _car_global_end = .; _car_relocatable_data_end = .; +#if !IS_ENABLED(CONFIG_C_ENVIRONMENT_BOOTBLOCK) + _car_stack_start = .; + _car_stack_end = _car_region_end; +#endif _car_region_end = . + CONFIG_DCACHE_RAM_SIZE - (. - _car_region_start); } diff --git a/src/cpu/intel/car/romstage.c b/src/cpu/intel/car/romstage.c index 1109d80442..e21ea467c2 100644 --- a/src/cpu/intel/car/romstage.c +++ b/src/cpu/intel/car/romstage.c @@ -28,15 +28,14 @@ asmlinkage void *romstage_main(unsigned long bist) u32 size; /* Size of unallocated CAR. */ - size = _car_region_end - _car_relocatable_data_end; - size = ALIGN_DOWN(size, 16); + size = ALIGN_DOWN(_car_stack_size, 16); size = MIN(size, DCACHE_RAM_ROMSTAGE_STACK_SIZE); if (size < DCACHE_RAM_ROMSTAGE_STACK_SIZE) printk(BIOS_DEBUG, "Romstage stack size limited to 0x%x!\n", size); - stack_base = (u32 *) (_car_region_end - size); + stack_base = (u32 *) (_car_stack_end - size); for (i = 0; i < num_guards; i++) stack_base[i] = stack_guard;