xtensa架构增加alloc异常入口

Signed-off-by: ou-yangkan <519689417@qq.com>
This commit is contained in:
ou-yangkan 2022-01-12 16:12:39 +08:00
parent b9c9936270
commit 697a0cbdeb
2 changed files with 43 additions and 4 deletions

View File

@ -142,6 +142,11 @@ extern "C" {
#else #else
#define CONTEXT_SIZE 112 #define CONTEXT_SIZE 112
#endif #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 EXCCAUSE_LEVEL1INTERRUPT 4
#define XTENSA_LOGREG_NUM 16 #define XTENSA_LOGREG_NUM 16
#define INDEX_OF_SP 1 #define INDEX_OF_SP 1

View File

@ -98,9 +98,6 @@ NMIExceptionHandler:
.literal_position .literal_position
DoubleExceptionHandler: DoubleExceptionHandler:
movi a0, INT_MASK | USER_VECTOR_MODE | WOE_ENABLE
wsr a0, PS
rsr a2, EXCCAUSE
call0 UserException call0 UserException
.end literal_prefix .end literal_prefix
@ -145,11 +142,18 @@ UserExceptionHandler:
UserException: UserException:
rsr a0, EXCCAUSE rsr a0, EXCCAUSE
beqi a0, 4, InterruptEntry1 beqi a0, LEVEL1_TINRERRUPT_CAUSE, InterruptEntry1
beqi a0, ALLOC_CAUSE, AllocHandel
call0 HandleEntry call0 HandleEntry
1: 1:
j 1b j 1b
.section .iram,"ax"
.type AllocHandel,@function
.align 4
AllocHandel:
call0 AllocHandelEntry
.section .iram,"ax" .section .iram,"ax"
.type InterruptEntry1,@function .type InterruptEntry1,@function
.align 4 .align 4
@ -361,6 +365,36 @@ UnderFlowGroup3:
l32i a4, a4, 0 l32i a4, a4, 0
rfwu 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 .global EnableExceptionInterface
.section .iram,"ax" .section .iram,"ax"
.type EnableExceptionInterface,@function .type EnableExceptionInterface,@function