提交 0ed8adfe 编写于 作者: Y YOUR_NAME

fix: no exception information output, when the system is abnormal after holding

the scheduling lock in SMP.

Change-Id: Idb793a5446126e638af52ff78b43bb7f8271317c
上级 806ce4eb
...@@ -189,6 +189,24 @@ STATIC INLINE UINT32 ArchIntUnlock(VOID) ...@@ -189,6 +189,24 @@ STATIC INLINE UINT32 ArchIntUnlock(VOID)
return intSave; return intSave;
} }
STATIC INLINE VOID ArchIrqDisable(VOID)
{
__asm__ __volatile__(
"cpsid i "
:
:
: "memory", "cc");
}
STATIC INLINE VOID ArchIrqEnable(VOID)
{
__asm__ __volatile__(
"cpsie i "
:
:
: "memory", "cc");
}
#else #else
STATIC INLINE UINT32 ArchIntLock(VOID) STATIC INLINE UINT32 ArchIntLock(VOID)
......
...@@ -185,18 +185,32 @@ STATIC INT32 OsDecodeDataFSR(UINT32 regDFSR) ...@@ -185,18 +185,32 @@ STATIC INT32 OsDecodeDataFSR(UINT32 regDFSR)
#ifdef LOSCFG_KERNEL_VM #ifdef LOSCFG_KERNEL_VM
UINT32 OsArmSharedPageFault(UINT32 excType, ExcContext *frame, UINT32 far, UINT32 fsr) UINT32 OsArmSharedPageFault(UINT32 excType, ExcContext *frame, UINT32 far, UINT32 fsr)
{ {
PRINT_INFO("page fault entry!!!\n"); BOOL instructionFault = FALSE;
BOOL instruction_fault = FALSE;
UINT32 pfFlags = 0; UINT32 pfFlags = 0;
UINT32 fsrFlag; UINT32 fsrFlag;
BOOL write = FALSE; BOOL write = FALSE;
UINT32 ret;
#ifdef LOSCFG_KERNEL_SMP
BOOL irqEnable = TRUE;
#endif
PRINT_INFO("page fault entry!!!\n");
if (OsGetSystemStatus() == OS_SYSTEM_EXC_CURR_CPU) { if (OsGetSystemStatus() == OS_SYSTEM_EXC_CURR_CPU) {
return LOS_ERRNO_VM_NOT_FOUND; return LOS_ERRNO_VM_NOT_FOUND;
} }
#ifdef LOSCFG_KERNEL_SMP
irqEnable = !(LOS_SpinHeld(&g_taskSpin) && (OsPercpuGet()->taskLockCnt != 0));
if (irqEnable) {
ArchIrqEnable();
} else {
PrintExcInfo("[ERR][%s] may be held scheduler lock when entering [%s]\n",
OsCurrTaskGet()->taskName, __FUNCTION__);
}
#else
ArchIrqEnable();
#endif
if (excType == OS_EXCEPT_PREFETCH_ABORT) { if (excType == OS_EXCEPT_PREFETCH_ABORT) {
instruction_fault = TRUE; instructionFault = TRUE;
} else { } else {
write = !!BIT_GET(fsr, WNR_BIT); write = !!BIT_GET(fsr, WNR_BIT);
} }
...@@ -214,13 +228,23 @@ UINT32 OsArmSharedPageFault(UINT32 excType, ExcContext *frame, UINT32 far, UINT3 ...@@ -214,13 +228,23 @@ UINT32 OsArmSharedPageFault(UINT32 excType, ExcContext *frame, UINT32 far, UINT3
BOOL user = (frame->regCPSR & CPSR_MODE_MASK) == CPSR_MODE_USR; BOOL user = (frame->regCPSR & CPSR_MODE_MASK) == CPSR_MODE_USR;
pfFlags |= write ? VM_MAP_PF_FLAG_WRITE : 0; pfFlags |= write ? VM_MAP_PF_FLAG_WRITE : 0;
pfFlags |= user ? VM_MAP_PF_FLAG_USER : 0; pfFlags |= user ? VM_MAP_PF_FLAG_USER : 0;
pfFlags |= instruction_fault ? VM_MAP_PF_FLAG_INSTRUCTION : 0; pfFlags |= instructionFault ? VM_MAP_PF_FLAG_INSTRUCTION : 0;
pfFlags |= VM_MAP_PF_FLAG_NOT_PRESENT; pfFlags |= VM_MAP_PF_FLAG_NOT_PRESENT;
return OsVmPageFaultHandler(far, pfFlags, frame); ret = OsVmPageFaultHandler(far, pfFlags, frame);
break;
} }
default: default:
return LOS_ERRNO_VM_NOT_FOUND; ret = LOS_ERRNO_VM_NOT_FOUND;
break;
}
#ifdef LOSCFG_KERNEL_SMP
if (irqEnable) {
ArchIrqDisable();
} }
#else
ArchIrqDisable();
#endif
return ret;
} }
#endif #endif
......
...@@ -205,9 +205,7 @@ _osExceptSwiHdl: ...@@ -205,9 +205,7 @@ _osExceptSwiHdl:
PUSH_FPU_REGS R1 PUSH_FPU_REGS R1
MOV FP, #0 @ Init frame pointer MOV FP, #0 @ Init frame pointer
CPSIE I
BLX OsArmA32SyscallHandle BLX OsArmA32SyscallHandle
CPSID I
POP_FPU_REGS R1 POP_FPU_REGS R1
ADD SP, SP,#4 ADD SP, SP,#4
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册