summaryrefslogtreecommitdiff
path: root/common/init/board_init.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-01-10 16:38:40 -0500
committerTom Rini <trini@konsulko.com>2020-01-10 16:38:40 -0500
commitef2f0d323652c1162937df668b33b3bfe0ca3904 (patch)
treef957b7e9edcf79403f8a582d17dc4103f293fc10 /common/init/board_init.c
parentc00bd81ae0d6eb1f94e26b31be3a64cadaa05bcb (diff)
parent4f731c795d75aee548f6886f4f0da0a49a99354d (diff)
Merge branch '2020-01-10-master-imports'
- Android image support enhancements - Assorted ARM fixes and enhancements - m68k update
Diffstat (limited to 'common/init/board_init.c')
-rw-r--r--common/init/board_init.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/common/init/board_init.c b/common/init/board_init.c
index e52106966d4..3bc7994586c 100644
--- a/common/init/board_init.c
+++ b/common/init/board_init.c
@@ -19,6 +19,19 @@ __weak void arch_setup_gd(struct global_data *gd_ptr)
#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
* determined in gd->start_addr_sp. Boards can override it to set up
* stack-checking markers.
@@ -129,6 +142,10 @@ void board_init_f_init_reserve(ulong base)
#if !defined(CONFIG_ARM)
arch_setup_gd(gd_ptr);
#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 */
base += roundup(sizeof(struct global_data), 16);