arch/x86: Add CAR stack location symbols

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 <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/30491
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Kyösti Mälkki 2018-12-28 19:18:46 +02:00
parent 1c10590307
commit d7892bc391
2 changed files with 6 additions and 3 deletions

View File

@ -86,6 +86,10 @@
_car_global_end = .; _car_global_end = .;
_car_relocatable_data_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); _car_region_end = . + CONFIG_DCACHE_RAM_SIZE - (. - _car_region_start);
} }

View File

@ -28,15 +28,14 @@ asmlinkage void *romstage_main(unsigned long bist)
u32 size; u32 size;
/* Size of unallocated CAR. */ /* Size of unallocated CAR. */
size = _car_region_end - _car_relocatable_data_end; size = ALIGN_DOWN(_car_stack_size, 16);
size = ALIGN_DOWN(size, 16);
size = MIN(size, DCACHE_RAM_ROMSTAGE_STACK_SIZE); size = MIN(size, DCACHE_RAM_ROMSTAGE_STACK_SIZE);
if (size < DCACHE_RAM_ROMSTAGE_STACK_SIZE) if (size < DCACHE_RAM_ROMSTAGE_STACK_SIZE)
printk(BIOS_DEBUG, "Romstage stack size limited to 0x%x!\n", printk(BIOS_DEBUG, "Romstage stack size limited to 0x%x!\n",
size); size);
stack_base = (u32 *) (_car_region_end - size); stack_base = (u32 *) (_car_stack_end - size);
for (i = 0; i < num_guards; i++) for (i = 0; i < num_guards; i++)
stack_base[i] = stack_guard; stack_base[i] = stack_guard;