From 86aff09c77d70f8782e17093d18b986cbd15000c Mon Sep 17 00:00:00 2001 From: Vincenzo Frascino Date: Wed, 29 Mar 2017 11:31:45 +0100 Subject: [PATCH] arm: core: Integrate thread stack guard feature This patch integrates the thread stack guard feature in the arm Zephyr core. Change-Id: I2022899cbc7a340be71cfaa52f79418292f93bae Signed-off-by: Vincenzo Frascino --- arch/arm/core/swap.S | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/core/swap.S b/arch/arm/core/swap.S index cb7b2e9eb7e..57027862108 100644 --- a/arch/arm/core/swap.S +++ b/arch/arm/core/swap.S @@ -179,6 +179,14 @@ _thread_irq_disabled: vldmia r0, {s16-s31} #endif +#ifdef CONFIG_MPU_STACK_GUARD + /* r2 contains k_thread */ + add r0, r2, #0 + push {r2, lr} + blx configure_mpu_stack_guard + pop {r2, lr} +#endif /* CONFIG_MPU_STACK_GUARD */ + /* load callee-saved + psp from thread */ add r0, r2, #_thread_offset_to_callee_saved ldmia r0, {v1-v8, ip}