feat: add blackbox for liteos_a

1、在内核增加BlackBox核心框架,对外提供模块回调接口注册和故障处理接口。
2、增加默认的系统模块适配层,处理通用内核态和用户态故障日志抓取和保存。

Close #I3NN7V

Signed-off-by: qidechun <qidechun@huawei.com>
This commit is contained in:
qidechun
2021-07-06 07:49:59 +08:00
parent 003810284c
commit 425975e481
17 changed files with 1256 additions and 3 deletions

View File

@@ -62,6 +62,9 @@
#ifdef LOSCFG_FS_VFS
#include "console.h"
#endif
#ifdef LOSCFG_BLACKBOX
#include "los_blackbox.h"
#endif
#define INVALID_CPUID 0xFFFF
@@ -589,6 +592,9 @@ STATIC VOID OsUserExcHandle(ExcContext *excBufAddr)
/* Exception handling All operations should be kept prior to that operation */
OsExcRestore();
/* kill user exc process */
#ifdef LOSCFG_BLACKBOX
BBoxNotifyError("USER_CRASH", MODULE_SYSTEM, "Crash in user", 0);
#endif
LOS_Exit(OS_PRO_EXIT_OK);
}
@@ -1058,6 +1064,9 @@ LITE_OS_SEC_TEXT VOID STATIC OsExcPriorDisposal(ExcContext *excBufAddr)
LITE_OS_SEC_TEXT_INIT STATIC VOID OsPrintExcHead(UINT32 far)
{
#ifdef LOSCFG_BLACKBOX
SetExcInfoIndex(0);
#endif
#ifdef LOSCFG_KERNEL_VM
/* You are not allowed to add any other print information before this exception information */
if (g_excFromUserMode[ArchCurrCpuid()] == TRUE) {
@@ -1125,7 +1134,9 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAd
if (g_curNestCount[ArchCurrCpuid()] == 1) {
#ifdef LOSCFG_SAVE_EXCINFO
if (func != NULL) {
#ifndef LOSCFG_BLACKBOX
SetExcInfoIndex(0);
#endif
OsSysStateSave(&intCount, &lockCount);
OsRecordExcInfoTime();
OsSysStateRestore(intCount, lockCount);
@@ -1154,6 +1165,9 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAd
}
#endif
#ifdef LOSCFG_BLACKBOX
BBoxNotifyError(EVENT_PANIC, MODULE_SYSTEM, "Crash in kernel", 1);
#endif
while (1) {}
}