intel/car: Fix stack guard placement

Make sure guard placement is above CAR region.

Change-Id: I780cdc0b2a549e7ac4b23b0870619f5648a644e7
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/21313
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Kyösti Mälkki 2017-09-01 07:10:56 +03:00
parent f8e9449df0
commit 65e54662e3
1 changed files with 14 additions and 3 deletions

View File

@ -15,6 +15,7 @@
#include <console/console.h> #include <console/console.h>
#include <cpu/intel/romstage.h> #include <cpu/intel/romstage.h>
#include <cpu/x86/mtrr.h> #include <cpu/x86/mtrr.h>
#include <arch/symbols.h>
#include <program_loading.h> #include <program_loading.h>
#define DCACHE_RAM_ROMSTAGE_STACK_SIZE 0x2000 #define DCACHE_RAM_ROMSTAGE_STACK_SIZE 0x2000
@ -25,9 +26,19 @@ asmlinkage void *romstage_main(unsigned long bist)
void *romstage_stack_after_car; void *romstage_stack_after_car;
const int num_guards = 4; const int num_guards = 4;
const u32 stack_guard = 0xdeadbeef; const u32 stack_guard = 0xdeadbeef;
u32 *stack_base = (void *)(CONFIG_DCACHE_RAM_BASE + u32 *stack_base;
CONFIG_DCACHE_RAM_SIZE - u32 size;
DCACHE_RAM_ROMSTAGE_STACK_SIZE);
/* Size of unallocated CAR. */
size = _car_region_end - _car_relocatable_data_end;
size = ALIGN_DOWN(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);
for (i = 0; i < num_guards; i++) for (i = 0; i < num_guards; i++)
stack_base[i] = stack_guard; stack_base[i] = stack_guard;