Skip to content
Permalink
Browse files

tests: kernel: fatal: check stack overflow of FP capable threads

Test the HW stack protection feature for threads that are
pre-tagged as FPU users, when building with support for FP
shared registers mode (CONFIG_FP_SHARING=y).

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
  • Loading branch information...
ioannisg authored and andrewboie committed Jun 25, 2019
1 parent 0bae5a4 commit bceca79804a95ecfc247fd4ae770f979515f10c1
Showing with 18 additions and 0 deletions.
  1. +18 −0 tests/kernel/fatal/src/main.c
@@ -308,6 +308,15 @@ void test_fatal(void)

TC_PRINT("test stack HW-based overflow - supervisor 2\n");
check_stack_overflow(stack_hw_overflow, 0);

#if defined(CONFIG_FLOAT) && defined(CONFIG_FP_SHARING)
TC_PRINT("test stack HW-based overflow (FPU thread) - supervisor 1\n");
check_stack_overflow(stack_hw_overflow, K_FP_REGS);

TC_PRINT("test stack HW-based overflow (FPU thread) - supervisor 2\n");
check_stack_overflow(stack_hw_overflow, K_FP_REGS);
#endif /* CONFIG_FLOAT && CONFIG_FP_SHARING */

#endif /* CONFIG_HW_STACK_PROTECTION */

#ifdef CONFIG_USERSPACE
@@ -323,6 +332,15 @@ void test_fatal(void)

TC_PRINT("test stack HW-based overflow - user priv stack 2\n");
check_stack_overflow(user_priv_stack_hw_overflow, K_USER);

#if defined(CONFIG_FLOAT) && defined(CONFIG_FP_SHARING)
TC_PRINT("test stack HW-based overflow (FPU thread) - user 1\n");
check_stack_overflow(stack_hw_overflow, K_USER | K_FP_REGS);

TC_PRINT("test stack HW-based overflow (FPU thread) - user 2\n");
check_stack_overflow(stack_hw_overflow, K_USER | K_FP_REGS);
#endif /* CONFIG_FLOAT && CONFIG_FP_SHARING */

#endif /* CONFIG_USERSPACE */

#endif /* !CONFIG_ARCH_POSIX */

0 comments on commit bceca79

Please sign in to comment.
You can’t perform that action at this time.