mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-21 17:16:29 +08:00
Merge branch 'feature/panic_close_isr_1st' into 'master'
Close ISR when panic See merge request sdk/ESP8266_RTOS_SDK!305
This commit is contained in:
@ -653,6 +653,8 @@ _DebugExceptionVector:
|
|||||||
jx a3
|
jx a3
|
||||||
#else
|
#else
|
||||||
wsr a0, EXCSAVE+XCHAL_DEBUGLEVEL /* save original a0 somewhere */
|
wsr a0, EXCSAVE+XCHAL_DEBUGLEVEL /* save original a0 somewhere */
|
||||||
|
wsr a0, EXCSAVE_1
|
||||||
|
wsr a1, EXCSAVE_2
|
||||||
call0 _xt_ext_panic /* does not return */
|
call0 _xt_ext_panic /* does not return */
|
||||||
rfi XCHAL_DEBUGLEVEL /* make a0 point here not later */
|
rfi XCHAL_DEBUGLEVEL /* make a0 point here not later */
|
||||||
#endif
|
#endif
|
||||||
@ -677,6 +679,7 @@ Double exceptions are not a normal occurrence. They indicate a bug of some kind.
|
|||||||
.literal_position
|
.literal_position
|
||||||
_DoubleExceptionVector:
|
_DoubleExceptionVector:
|
||||||
wsr a0, EXCSAVE_1
|
wsr a0, EXCSAVE_1
|
||||||
|
wsr a1, EXCSAVE_2
|
||||||
j _xt_ext_panic
|
j _xt_ext_panic
|
||||||
|
|
||||||
#if XCHAL_HAVE_DEBUG
|
#if XCHAL_HAVE_DEBUG
|
||||||
@ -702,6 +705,7 @@ Kernel Exception (including Level 1 Interrupt from kernel mode).
|
|||||||
.literal_position
|
.literal_position
|
||||||
_KernelExceptionVector:
|
_KernelExceptionVector:
|
||||||
wsr a0, EXCSAVE_1 /* preserve a0 */
|
wsr a0, EXCSAVE_1 /* preserve a0 */
|
||||||
|
wsr a1, EXCSAVE_2
|
||||||
j _xt_ext_panic
|
j _xt_ext_panic
|
||||||
|
|
||||||
/* never returns here - call0 is used as a jump (see note at top) */
|
/* never returns here - call0 is used as a jump (see note at top) */
|
||||||
@ -1512,13 +1516,21 @@ nmi_common_panic:
|
|||||||
.align 4
|
.align 4
|
||||||
.literal_position
|
.literal_position
|
||||||
_xt_ext_panic:
|
_xt_ext_panic:
|
||||||
|
/*
|
||||||
|
* First close intrrupt, only use code, can't use data
|
||||||
|
*
|
||||||
|
* Todo: Close NMI
|
||||||
|
*/
|
||||||
|
rsil a0, XCHAL_EXCM_LEVEL
|
||||||
|
wsr a0, EXCSAVE_2
|
||||||
|
|
||||||
/* Allocate exception frame and save minimal context. */
|
/* Allocate exception frame and save minimal context. */
|
||||||
mov a0, sp
|
mov a0, sp
|
||||||
movi sp, _chip_interrupt_tmp
|
movi sp, _chip_interrupt_tmp
|
||||||
addi sp, sp, -XT_STK_FRMSZ
|
addi sp, sp, -XT_STK_FRMSZ
|
||||||
s32i a0, sp, XT_STK_A1
|
s32i a0, sp, XT_STK_A1
|
||||||
|
|
||||||
rsr a0, PS /* save interruptee's PS */
|
rsr a0, EXCSAVE_2 /* save interruptee's PS */
|
||||||
s32i a0, sp, XT_STK_PS
|
s32i a0, sp, XT_STK_PS
|
||||||
rsr a0, EPC_1 /* save interruptee's PC */
|
rsr a0, EPC_1 /* save interruptee's PC */
|
||||||
s32i a0, sp, XT_STK_PC
|
s32i a0, sp, XT_STK_PC
|
||||||
@ -1538,10 +1550,6 @@ _xt_ext_panic:
|
|||||||
|
|
||||||
s32i a0, sp, XT_STK_A0
|
s32i a0, sp, XT_STK_A0
|
||||||
|
|
||||||
/* Set up PS for C, disable all interrupts except NMI and debug, and clear EXCM. */
|
|
||||||
movi a0, PS_INTLEVEL(5) | PS_UM | PS_WOE
|
|
||||||
wsr a0, PS
|
|
||||||
|
|
||||||
//Call panic handler
|
//Call panic handler
|
||||||
mov a2, sp
|
mov a2, sp
|
||||||
call0 panicHandler
|
call0 panicHandler
|
||||||
|
@ -975,9 +975,7 @@ int lwip_close(int s)
|
|||||||
SYS_ARCH_DECL_PROTECT(lev);
|
SYS_ARCH_DECL_PROTECT(lev);
|
||||||
sys_mutex_t lock_tmp[SOCK_MT_LOCK_MAX];
|
sys_mutex_t lock_tmp[SOCK_MT_LOCK_MAX];
|
||||||
|
|
||||||
ret = lwip_shutdown(s, SHUT_RDWR);
|
lwip_shutdown(s, SHUT_RDWR);
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
LWIP_ENTER_MT(s, SOCK_MT_CLOSE, 0);
|
LWIP_ENTER_MT(s, SOCK_MT_CLOSE, 0);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user