diff options
author | Tom Rini <trini@konsulko.com> | 2019-08-12 18:46:07 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-08-12 18:46:07 -0400 |
commit | 5939afc9611e8ba4a86b96e67670b765ee27668e (patch) | |
tree | 369402e0305a7b8f9f905baec6387bfd9683ba71 /common/init/board_init.c | |
parent | d7ae932152ddf58125a05f4eb28596d9b31bdb1e (diff) | |
parent | ec1fa18561f818bee252da2c331d371ad26037d2 (diff) |
Merge branch '2019-08-11-master-imports'
- environment cleanup
- HiKey 960 support
- Some PCI fixes
Diffstat (limited to 'common/init/board_init.c')
-rw-r--r-- | common/init/board_init.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/common/init/board_init.c b/common/init/board_init.c index 526fee35ff6..e52106966d4 100644 --- a/common/init/board_init.c +++ b/common/init/board_init.c @@ -18,6 +18,23 @@ __weak void arch_setup_gd(struct global_data *gd_ptr) } #endif /* !CONFIG_X86 && !CONFIG_ARM */ +/** + * This function is called after the position of the initial stack is + * determined in gd->start_addr_sp. Boards can override it to set up + * stack-checking markers. + */ +__weak void board_init_f_init_stack_protection(void) +{ +#if CONFIG_IS_ENABLED(SYS_REPORT_STACK_F_USAGE) + ulong stack_bottom = gd->start_addr_sp - + CONFIG_VAL(SIZE_LIMIT_PROVIDE_STACK); + + /* substact some safety margin (0x20) since stack is in use here */ + memset((void *)stack_bottom, CONFIG_VAL(SYS_STACK_F_CHECK_BYTE), + CONFIG_VAL(SIZE_LIMIT_PROVIDE_STACK) - 0x20); +#endif +} + /* * Allocate reserved space for use as 'globals' from 'top' address and * return 'bottom' address of allocated space @@ -126,6 +143,9 @@ void board_init_f_init_reserve(ulong base) /* next alloc will be higher by one 'early malloc arena' size */ base += CONFIG_VAL(SYS_MALLOC_F_LEN); #endif + + if (CONFIG_IS_ENABLED(SYS_REPORT_STACK_F_USAGE)) + board_init_f_init_stack_protection(); } /* |