mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-19 05:31:32 +00:00
spl: fix stack usage check if gd is not initialized
Most platforms do not set up gd->start_addr_sp in SPL. Since this is
required for CONFIG_SPL_SYS_REPORT_SACK_F_USAGE to work correctly, set
up gd->start_addr_sp in SPL to the value passed to
board_init_f_init_reserve if it is not set yet.
Fixes: d8c0332031
("spl: implement stack usage check")
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
This commit is contained in:
parent
8947145cd0
commit
c82abaa5d6
1 changed files with 17 additions and 0 deletions
|
@ -18,6 +18,19 @@ __weak void arch_setup_gd(struct global_data *gd_ptr)
|
||||||
}
|
}
|
||||||
#endif /* !CONFIG_X86 && !CONFIG_ARM */
|
#endif /* !CONFIG_X86 && !CONFIG_ARM */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is called from board_init_f_init_reserve to set up
|
||||||
|
* gd->start_addr_sp for stack protection if not already set otherwise
|
||||||
|
*/
|
||||||
|
__weak void board_init_f_init_stack_protection_addr(ulong base)
|
||||||
|
{
|
||||||
|
#if CONFIG_IS_ENABLED(SYS_REPORT_STACK_F_USAGE)
|
||||||
|
/* set up stack pointer for stack usage if not set yet */
|
||||||
|
if (!gd->start_addr_sp)
|
||||||
|
gd->start_addr_sp = base;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called after the position of the initial stack is
|
* 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
|
* determined in gd->start_addr_sp. Boards can override it to set up
|
||||||
|
@ -129,6 +142,10 @@ void board_init_f_init_reserve(ulong base)
|
||||||
#if !defined(CONFIG_ARM)
|
#if !defined(CONFIG_ARM)
|
||||||
arch_setup_gd(gd_ptr);
|
arch_setup_gd(gd_ptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (CONFIG_IS_ENABLED(SYS_REPORT_STACK_F_USAGE))
|
||||||
|
board_init_f_init_stack_protection_addr(base);
|
||||||
|
|
||||||
/* next alloc will be higher by one GD plus 16-byte alignment */
|
/* next alloc will be higher by one GD plus 16-byte alignment */
|
||||||
base += roundup(sizeof(struct global_data), 16);
|
base += roundup(sizeof(struct global_data), 16);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue