Label exceptions.

This commit is contained in:
Brad Nelson
2023-02-05 12:22:12 -08:00
parent 2b05d7794e
commit db72474bcb

View File

@ -79,30 +79,40 @@ static void IRAM_ATTR forth_exception_handler(XtExcFrame *frame) {
} }
static void forth_faults_setup(void) { static void forth_faults_setup(void) {
xt_set_exception_handler(EXCCAUSE_DIVIDE_BY_ZERO, forth_exception_handler); xt_set_exception_handler(EXCCAUSE_ILLEGAL, forth_exception_handler); // 0
xt_set_exception_handler(EXCCAUSE_DTLB_MISS, forth_exception_handler); // EXCCAUSE_SYSCALL - used for syscalls // 1
xt_set_exception_handler(EXCCAUSE_DTLB_MULTIHIT, forth_exception_handler); xt_set_exception_handler(EXCCAUSE_INSTR_ERROR, forth_exception_handler); // 2
xt_set_exception_handler(EXCCAUSE_EXCLUSIVE_ERROR, forth_exception_handler); xt_set_exception_handler(EXCCAUSE_LOAD_STORE_ERROR, forth_exception_handler); // 3
xt_set_exception_handler(EXCCAUSE_EXTREG_PRIVILEGE, forth_exception_handler); xt_set_exception_handler(EXCCAUSE_LEVEL1_INTERRUPT, forth_exception_handler); // 4
xt_set_exception_handler(EXCCAUSE_ILLEGAL, forth_exception_handler); // EXCCAUSE_ALLOCA - used to grow with alloca // 5
xt_set_exception_handler(EXCCAUSE_INSTR_ADDR_ERROR, forth_exception_handler); xt_set_exception_handler(EXCCAUSE_DIVIDE_BY_ZERO, forth_exception_handler); // 6
xt_set_exception_handler(EXCCAUSE_INSTR_DATA_ERROR, forth_exception_handler); xt_set_exception_handler(EXCCAUSE_PC_ERROR, forth_exception_handler); // 7
xt_set_exception_handler(EXCCAUSE_INSTR_ERROR, forth_exception_handler); xt_set_exception_handler(EXCCAUSE_PRIVILEGED, forth_exception_handler); // 8
xt_set_exception_handler(EXCCAUSE_INSTR_PROHIBITED, forth_exception_handler); xt_set_exception_handler(EXCCAUSE_UNALIGNED, forth_exception_handler); // 9
xt_set_exception_handler(EXCCAUSE_INSTR_RING, forth_exception_handler); xt_set_exception_handler(EXCCAUSE_EXTREG_PRIVILEGE, forth_exception_handler); // 10
xt_set_exception_handler(EXCCAUSE_ITLB_MISS, forth_exception_handler); xt_set_exception_handler(EXCCAUSE_EXCLUSIVE_ERROR, forth_exception_handler); // 11
xt_set_exception_handler(EXCCAUSE_ITLB_MULTIHIT, forth_exception_handler); xt_set_exception_handler(EXCCAUSE_INSTR_DATA_ERROR, forth_exception_handler); // 12
xt_set_exception_handler(EXCCAUSE_LOAD_PROHIBITED, forth_exception_handler); xt_set_exception_handler(EXCCAUSE_LOAD_STORE_DATA_ERROR, forth_exception_handler); // 13
xt_set_exception_handler(EXCCAUSE_LOAD_STORE_ADDR_ERROR, forth_exception_handler); xt_set_exception_handler(EXCCAUSE_INSTR_ADDR_ERROR, forth_exception_handler); // 14
xt_set_exception_handler(EXCCAUSE_LOAD_STORE_DATA_ERROR, forth_exception_handler); xt_set_exception_handler(EXCCAUSE_LOAD_STORE_ADDR_ERROR, forth_exception_handler); // 15
xt_set_exception_handler(EXCCAUSE_LOAD_STORE_ERROR, forth_exception_handler); xt_set_exception_handler(EXCCAUSE_ITLB_MISS, forth_exception_handler); // 16
xt_set_exception_handler(EXCCAUSE_LOAD_STORE_RING, forth_exception_handler); xt_set_exception_handler(EXCCAUSE_ITLB_MULTIHIT, forth_exception_handler); // 17
xt_set_exception_handler(EXCCAUSE_PC_ERROR, forth_exception_handler); xt_set_exception_handler(EXCCAUSE_INSTR_RING, forth_exception_handler); // 18
xt_set_exception_handler(EXCCAUSE_PRIVILEGED, forth_exception_handler); // Reserved // 19
xt_set_exception_handler(EXCCAUSE_STORE_PROHIBITED, forth_exception_handler); xt_set_exception_handler(EXCCAUSE_INSTR_PROHIBITED, forth_exception_handler); // 20
xt_set_exception_handler(EXCCAUSE_UNALIGNED, forth_exception_handler); // Reserved // 21
// Reserved // 22
// Reserved // 23
xt_set_exception_handler(EXCCAUSE_DTLB_MISS, forth_exception_handler); // 24
xt_set_exception_handler(EXCCAUSE_DTLB_MULTIHIT, forth_exception_handler); // 25
xt_set_exception_handler(EXCCAUSE_LOAD_STORE_RING, forth_exception_handler); // 26
// Reserved // 27
xt_set_exception_handler(EXCCAUSE_LOAD_PROHIBITED, forth_exception_handler); // 28
xt_set_exception_handler(EXCCAUSE_STORE_PROHIBITED, forth_exception_handler); // 29
// Reserved // 30
// Reserved // 31
for (int i = 0; i < 8; ++i) { for (int i = 0; i < 8; ++i) {
xt_set_exception_handler(EXCCAUSE_CP_DISABLED(i), forth_exception_handler); xt_set_exception_handler(EXCCAUSE_CP_DISABLED(i), forth_exception_handler); // 32-39
} }
uint32_t default_setlevel = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); uint32_t default_setlevel = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL);
XTOS_RESTORE_INTLEVEL(default_setlevel); XTOS_RESTORE_INTLEVEL(default_setlevel);