arch: arm: internal API to check return execution mode
We add an ARM internal API which allows the kernel to infer the execution mode we are going to return after the current exception. Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit is contained in:
parent
f030608701
commit
17630f637e
1 changed files with 26 additions and 0 deletions
|
@ -48,6 +48,32 @@ static ALWAYS_INLINE bool z_arch_is_in_isr(void)
|
|||
return (__get_IPSR()) ? (true) : (false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Find out if we were in ISR context
|
||||
* before the current exception occurred.
|
||||
*
|
||||
* A function that determines, based on inspecting the current
|
||||
* ESF, whether the processor was in handler mode before entering
|
||||
* the current exception state (i.e. nested exception) or not.
|
||||
*
|
||||
* Notes:
|
||||
* - The function shall only be called from ISR context.
|
||||
* - We do not use ARM processor state flags to determine
|
||||
* whether we are in a nested exception; we rely on the
|
||||
* RETPSR value stacked on the ESF. Hence, the function
|
||||
* assumes that the ESF stack frame has a valid RETPSR
|
||||
* value.
|
||||
*
|
||||
* @param esf the exception stack frame (cannot be NULL)
|
||||
* @return true if execution state was in handler mode, before
|
||||
* the current exception occurred, otherwise false.
|
||||
*/
|
||||
static ALWAYS_INLINE bool z_arch_is_in_nested_exception(
|
||||
const z_arch_esf_t *esf)
|
||||
{
|
||||
return (esf->basic.xpsr & IPSR_ISR_Msk) ? (true) : (false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Setup system exceptions
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue