/* Common NMI and Exception handler entry. 
This function provided a command entry for NMI and exception. Silicon Vendor could modify this template implementation according to requirement.  */
uint32_t core_exception_handler(unsigned long mcause, unsigned long sp)
/* Common NMI and Exception handler entry. 
This function provided a command entry for NMI and exception. Silicon Vendor could modify this template implementation according to requirement.  */
uint32_t core_exception_handler(unsigned long mcause, unsigned long sp)
{
    uint32_t EXCn = (uint32_t)(mcause & 0X00000fff);
    EXC_HANDLER exc_handler;
    if ((EXCn < MAX_SYSTEM_EXCEPTION_NUM) && (EXCn > 0)) {
        exc_handler = (EXC_HANDLER)SystemExceptionHandlers[EXCn];
    } else if (EXCn == NMI_EXCn) {
        exc_handler = (EXC_HANDLER)SystemExceptionHandlers[MAX_SYSTEM_EXCEPTION_NUM];
    } else {
        exc_handler = (EXC_HANDLER)system_default_exception_handler;
    }
    if (exc_handler != NULL) {
        exc_handler(mcause, sp);
    }
    return 0;
}
/** @}