xPortIsInsideInterrupt for arm64

We’d like to check if we are inside an interrupt handler on an arm64 (aarch64) port. I’ve seen this post [I’m not allowed to link but it’s post 13776 in this forum] but it looks like this only works if the processor implements GIC.

It looks like the aarch64 port already has a variable to track interrupt nesting: ullPortInterruptNesting.

We wanted to implement something like:

BaseType_t xPortIsInsideInterrupt( void )
{
    BaseType_t xReturn;

    if( ullPortInterruptNesting == 0 )
    {
        xReturn = pdFALSE;
    }
    else
    {
        xReturn = pdTRUE;
    }

    return xReturn;
}

This seems to work in my basic tests, are there any corner cases I’m missing?

That seems correct and should work!