nios2: implement _IS_IN_ISR()
We check to see if the stack pointer is somwhere on the interrupt stack. Change-Id: Ic9d21e9f03476b9c8955c44cbfa2e61dd1daed22 Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
be13e26586
commit
99b2866ed2
1 changed files with 9 additions and 2 deletions
|
@ -186,8 +186,15 @@ FUNC_NORETURN void _NanoFatalErrorHandler(unsigned int reason,
|
|||
|
||||
static ALWAYS_INLINE int _IS_IN_ISR(void)
|
||||
{
|
||||
/* STUB */
|
||||
char *sp = (char *)_nios2_read_sp();
|
||||
|
||||
/* Make sure we're on the interrupt stack somewhere */
|
||||
if (sp < _interrupt_stack ||
|
||||
sp >= (char *)(STACK_ROUND_DOWN(_interrupt_stack +
|
||||
CONFIG_ISR_STACK_SIZE))) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue