!185 多核情况下当系统持有调度锁异常时,无异常信息输出

Merge pull request !185 from zhangfanfan2/master
This commit is contained in:
openharmony_ci 2021-04-28 08:53:15 +08:00 committed by Gitee
commit 28df6989f9
3 changed files with 46 additions and 9 deletions

View File

@ -189,6 +189,24 @@ STATIC INLINE UINT32 ArchIntUnlock(VOID)
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
STATIC INLINE UINT32 ArchIntLock(VOID)

View File

@ -185,18 +185,29 @@ STATIC INT32 OsDecodeDataFSR(UINT32 regDFSR)
#ifdef LOSCFG_KERNEL_VM
UINT32 OsArmSharedPageFault(UINT32 excType, ExcContext *frame, UINT32 far, UINT32 fsr)
{
PRINT_INFO("page fault entry!!!\n");
BOOL instruction_fault = FALSE;
BOOL instructionFault = FALSE;
UINT32 pfFlags = 0;
UINT32 fsrFlag;
BOOL write = FALSE;
UINT32 ret;
PRINT_INFO("page fault entry!!!\n");
if (OsGetSystemStatus() == OS_SYSTEM_EXC_CURR_CPU) {
return LOS_ERRNO_VM_NOT_FOUND;
}
#if defined(LOSCFG_KERNEL_SMP) && defined(LOSCFG_DEBUG_VERSION)
BOOL 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) {
instruction_fault = TRUE;
instructionFault = TRUE;
} else {
write = !!BIT_GET(fsr, WNR_BIT);
}
@ -214,13 +225,23 @@ UINT32 OsArmSharedPageFault(UINT32 excType, ExcContext *frame, UINT32 far, UINT3
BOOL user = (frame->regCPSR & CPSR_MODE_MASK) == CPSR_MODE_USR;
pfFlags |= write ? VM_MAP_PF_FLAG_WRITE : 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;
return OsVmPageFaultHandler(far, pfFlags, frame);
ret = OsVmPageFaultHandler(far, pfFlags, frame);
break;
}
default:
return LOS_ERRNO_VM_NOT_FOUND;
ret = LOS_ERRNO_VM_NOT_FOUND;
break;
}
#if defined(LOSCFG_KERNEL_SMP) && defined(LOSCFG_DEBUG_VERSION)
if (irqEnable) {
ArchIrqDisable();
}
#else
ArchIrqDisable();
#endif
return ret;
}
#endif

View File

@ -331,9 +331,7 @@ _osExcPageFault:
MOV R5, R0
MOV R8, R2
MOV R9, R3
CPSIE I
BLX OsArmSharedPageFault
CPSID I
POP_FPU_REGS R1
MOV SP, R4