stack_sentinel: change cooperative check

One of the stack sentinel policies was to check the sentinel
any time a cooperative context switch is done (i.e, _Swap is
called).

This was done by adding a hook to _check_stack_sentinel in
every arch's __swap function.

This way is cleaner as we just have the hook in one inline
function rather than implemented in several different assembly
dialects.

The check upon interrupt is now made unconditionally rather
than checking if we are calling __swap, since the check now
is only called on cooperative _Swap(). The interrupt is always
serviced first.

Issue: ZEP-2244
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2017-06-07 09:33:16 -07:00 committed by Maureen Helm
commit ae1a75b82e
9 changed files with 27 additions and 48 deletions

View file

@ -59,12 +59,6 @@ SECTION_FUNC(exception.other, __swap)
#if CONFIG_KERNEL_EVENT_LOGGER_CONTEXT_SWITCH
call _sys_k_event_logger_context_switch
#endif
#ifdef CONFIG_STACK_SENTINEL
call _check_stack_sentinel
#endif
#if defined(CONFIG_STACK_SENTINEL) || \
defined (CONFIG_KERNEL_EVENT_LOGGER_CONTEXT_SWITCH)
/* restore caller-saved r10 */
movhi r10, %hi(_kernel)
ori r10, r10, %lo(_kernel)