xtensa: move register_exceptions() to init.c

register_exceptions() and exception() are only used in init.c, move
them there.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
Guennadi Liakhovetski 2020-11-19 11:35:28 +01:00 committed by Liam Girdwood
parent baf061d5d8
commit 7b1d54087c
2 changed files with 97 additions and 97 deletions

View File

@ -26,103 +26,6 @@
struct sof;
/**
* \brief Called in the case of exception.
*/
static inline void exception(void)
{
uintptr_t epc1;
__asm__ __volatile__("rsr %0, EPC1" : "=a" (epc1) : : "memory");
/* now save panic dump */
/* TODO: we could invoke a GDB stub here */
panic_dump(SOF_IPC_PANIC_EXCEPTION, NULL, &epc1);
}
/**
* \brief Registers exception handlers.
*/
static inline void register_exceptions(void)
{
/* 0 - 9 */
_xtos_set_exception_handler(
EXCCAUSE_ILLEGAL, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_SYSCALL, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_INSTR_ERROR, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_LOAD_STORE_ERROR, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_ALLOCA, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_DIVIDE_BY_ZERO, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_SPECULATION, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_PRIVILEGED, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_UNALIGNED, (void *)&exception);
/* Reserved 10..11 */
_xtos_set_exception_handler(
EXCCAUSE_INSTR_DATA_ERROR, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_LOAD_STORE_DATA_ERROR, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_INSTR_ADDR_ERROR, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_LOAD_STORE_ADDR_ERROR, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_ITLB_MISS, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_ITLB_MULTIHIT, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_INSTR_RING, (void *)&exception);
/* Reserved 19 */
_xtos_set_exception_handler(
EXCCAUSE_INSTR_PROHIBITED, (void *)&exception);
/* Reserved 21..23 */
_xtos_set_exception_handler(
EXCCAUSE_DTLB_MISS, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_DTLB_MULTIHIT, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_LOAD_STORE_RING, (void *)&exception);
/* Reserved 27 */
_xtos_set_exception_handler(
EXCCAUSE_LOAD_PROHIBITED, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_STORE_PROHIBITED, (void *)&exception);
/* Reserved 30..31 */
_xtos_set_exception_handler(
EXCCAUSE_CP0_DISABLED, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_CP1_DISABLED, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_CP2_DISABLED, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_CP3_DISABLED, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_CP4_DISABLED, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_CP5_DISABLED, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_CP6_DISABLED, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_CP7_DISABLED, (void *)&exception);
/* Reserved 40..63 */
}
/**
* \brief Called from assembler context with no return or parameters.
*/

View File

@ -98,6 +98,103 @@ static void initialize_pointers_per_core(void)
#endif
}
/**
* \brief Called in the case of exception.
*/
static void exception(void)
{
uintptr_t epc1;
__asm__ __volatile__("rsr %0, EPC1" : "=a" (epc1) : : "memory");
/* now save panic dump */
/* TODO: we could invoke a GDB stub here */
panic_dump(SOF_IPC_PANIC_EXCEPTION, NULL, &epc1);
}
/**
* \brief Registers exception handlers.
*/
static void register_exceptions(void)
{
/* 0 - 9 */
_xtos_set_exception_handler(
EXCCAUSE_ILLEGAL, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_SYSCALL, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_INSTR_ERROR, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_LOAD_STORE_ERROR, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_ALLOCA, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_DIVIDE_BY_ZERO, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_SPECULATION, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_PRIVILEGED, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_UNALIGNED, (void *)&exception);
/* Reserved 10..11 */
_xtos_set_exception_handler(
EXCCAUSE_INSTR_DATA_ERROR, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_LOAD_STORE_DATA_ERROR, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_INSTR_ADDR_ERROR, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_LOAD_STORE_ADDR_ERROR, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_ITLB_MISS, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_ITLB_MULTIHIT, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_INSTR_RING, (void *)&exception);
/* Reserved 19 */
_xtos_set_exception_handler(
EXCCAUSE_INSTR_PROHIBITED, (void *)&exception);
/* Reserved 21..23 */
_xtos_set_exception_handler(
EXCCAUSE_DTLB_MISS, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_DTLB_MULTIHIT, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_LOAD_STORE_RING, (void *)&exception);
/* Reserved 27 */
_xtos_set_exception_handler(
EXCCAUSE_LOAD_PROHIBITED, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_STORE_PROHIBITED, (void *)&exception);
/* Reserved 30..31 */
_xtos_set_exception_handler(
EXCCAUSE_CP0_DISABLED, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_CP1_DISABLED, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_CP2_DISABLED, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_CP3_DISABLED, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_CP4_DISABLED, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_CP5_DISABLED, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_CP6_DISABLED, (void *)&exception);
_xtos_set_exception_handler(
EXCCAUSE_CP7_DISABLED, (void *)&exception);
/* Reserved 40..63 */
}
/**
* \brief Initializes architecture.
* \return Error status.