diff --git a/arch/xtensa/lx6/gcc/los_arch_regs.h b/arch/xtensa/lx6/gcc/los_arch_regs.h index 3aa7d3023f9ac6c50b3400cd954d596cbfff56ea..dba84aee1bfdf792570552c1bd625f4e3a9ece9a 100644 --- a/arch/xtensa/lx6/gcc/los_arch_regs.h +++ b/arch/xtensa/lx6/gcc/los_arch_regs.h @@ -142,6 +142,11 @@ extern "C" { #else #define CONTEXT_SIZE 112 #endif +#define LEVEL1_TINRERRUPT_CAUSE 4 +#define ALLOC_CAUSE 5 +#define LOWBIT_CALLNMODE 30 +#define HIGHBIT_CALLNMODE 31 +#define PS_OWB_SHIFT 8 #define EXCCAUSE_LEVEL1INTERRUPT 4 #define XTENSA_LOGREG_NUM 16 #define INDEX_OF_SP 1 diff --git a/arch/xtensa/lx6/gcc/los_exc.S b/arch/xtensa/lx6/gcc/los_exc.S index 79b5ca6e2879b746d382f4d00373128ded9c104a..34eca59d015e3f594e23d6f68df8e32176c203db 100644 --- a/arch/xtensa/lx6/gcc/los_exc.S +++ b/arch/xtensa/lx6/gcc/los_exc.S @@ -98,9 +98,6 @@ NMIExceptionHandler: .literal_position DoubleExceptionHandler: - movi a0, INT_MASK | USER_VECTOR_MODE | WOE_ENABLE - wsr a0, PS - rsr a2, EXCCAUSE call0 UserException .end literal_prefix @@ -145,11 +142,18 @@ UserExceptionHandler: UserException: rsr a0, EXCCAUSE - beqi a0, 4, InterruptEntry1 + beqi a0, LEVEL1_TINRERRUPT_CAUSE, InterruptEntry1 + beqi a0, ALLOC_CAUSE, AllocHandel call0 HandleEntry 1: j 1b +.section .iram,"ax" +.type AllocHandel,@function +.align 4 +AllocHandel: + call0 AllocHandelEntry + .section .iram,"ax" .type InterruptEntry1,@function .align 4 @@ -361,6 +365,36 @@ UnderFlowGroup3: l32i a4, a4, 0 rfwu +.section .userVector,"ax" +.type AllocHandelEntry,@function +.align 4 +AllocHandelEntry: + + addi a1, a1, -(CONTEXT_OFF_A4 - CONTEXT_OFF_A0) + s32i a2, a1, (CONTEXT_OFF_A2 - CONTEXT_OFF_A0) + s32i a3, a1, (CONTEXT_OFF_A3 - CONTEXT_OFF_A0) + + rsr a0, PS + rsr a2, WINDOWBASE + extui a3, a0, PS_OWB_SHIFT, WINDOWBASEBITS + xor a3, a3, a2 + slli a3, a3, PS_OWB_SHIFT + xor a0, a0, a3 + wsr a0, PS + rsr a0, EXCSAVE1 + + l32i a2, a1, (CONTEXT_OFF_A2 - CONTEXT_OFF_A0) + l32i a3, a1, (CONTEXT_OFF_A3 - CONTEXT_OFF_A0) + addi a1, a1, (CONTEXT_OFF_A4 - CONTEXT_OFF_A0) + rsync + + rotw -1 + bbci a4, HIGHBIT_CALLNMODE, UnderFlowGroup1 + rotw -1 + bbci a8, LOWBIT_CALLNMODE, UnderFlowGroup2 + rotw -1 + j UnderFlowGroup3 + .global EnableExceptionInterface .section .iram,"ax" .type EnableExceptionInterface,@function