提交 47420159 编写于 作者: A arvinzzz

feat: 提供死机场景下dump文件的能力

死机场景下,vfs层锁会放开,提供dump文件的能力
Signed-off-by: Narvinzzz <zhaotianyu9@huawei.com>
Change-Id: Id8c9e63fbf011dbc6690b9b4557bd3370353bf21
上级 e540254e
......@@ -40,7 +40,7 @@
#include "securec.h"
#include "los_compiler.h"
#include "los_debug.h"
#include "cmsis_os2.h"
#include "los_sched.h"
#include "vfs_files.h"
#include "vfs_operations.h"
#include "vfs_partition.h"
......@@ -73,7 +73,7 @@ static int FsLock(void)
{
int ret = 0;
struct timespec absTimeout = {0};
if (osKernelGetState() != osKernelRunning) {
if (!OsCheckKernelRunning()) {
return ret;
}
ret = clock_gettime(CLOCK_REALTIME, &absTimeout);
......@@ -88,7 +88,7 @@ static int FsLock(void)
static void FsUnlock(void)
{
if (osKernelGetState() != osKernelRunning) {
if (!OsCheckKernelRunning()) {
return;
}
(void)pthread_mutex_unlock(&g_fatfsMutex);
......
......@@ -40,6 +40,7 @@
#include "fcntl.h"
#include "los_mux.h"
#include "los_debug.h"
#include "los_sched.h"
#include "limits.h"
#include "securec.h"
#include "vfs_config.h"
......@@ -96,6 +97,9 @@ UINT32 g_fsMutex;
int VfsLock(void)
{
if (!OsCheckKernelRunning()) {
return LOS_OK;
}
if (LOS_MuxPend(g_fsMutex, LOS_WAIT_FOREVER) != LOS_OK) {
PRINT_ERR("VfsLock failed!");
return (int)LOS_NOK;
......@@ -106,6 +110,9 @@ int VfsLock(void)
void VfsUnlock(void)
{
if (!OsCheckKernelRunning()) {
return;
}
(void)LOS_MuxPost(g_fsMutex);
}
......
......@@ -96,6 +96,11 @@ STATIC INLINE UINT64 OsGetCurrSchedTimeCycle(VOID)
return LOS_SysCycleGet();
}
STATIC INLINE BOOL OsCheckKernelRunning(VOID)
{
return (g_taskScheduled && LOS_CHECK_SCHEDULE);
}
/**
* @ingroup los_sched
* @brief Get the time, in nanoseconds, remaining before the next tick interrupt response.
......
......@@ -120,21 +120,6 @@ LITE_OS_SEC_TEXT_INIT VOID LOS_Panic(const CHAR *fmt, ...)
ArchSysExit();
}
/*****************************************************************************
Function : OsRegister
Description : Configuring the maximum number of tasks
Input : None
Output : None
Return : None
*****************************************************************************/
LITE_OS_SEC_TEXT_INIT static VOID OsRegister(VOID)
{
g_taskMaxNum = LOSCFG_BASE_CORE_TSK_LIMIT + 1; /* Reserved 1 for IDLE */
return;
}
LITE_OS_SEC_TEXT_INIT UINT32 LOS_Start(VOID)
{
return ArchStartSchedule();
......@@ -156,8 +141,6 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
OsBackTraceInit();
#endif
OsRegister();
#ifdef LOSCFG_KERNEL_LMS
OsLmsInit();
#endif
......
......@@ -618,7 +618,7 @@ VOID LOS_SchedTickHandler(VOID)
VOID LOS_Schedule(VOID)
{
if (g_taskScheduled && LOS_CHECK_SCHEDULE) {
if (OsCheckKernelRunning()) {
ArchTaskSchedule();
}
}
......@@ -75,7 +75,7 @@
* @ingroup los_task
* @brief check task id's validation
*/
#define OS_TASK_ID_CHECK(taskID) LOS_ASSERT_COND(OS_TSK_GET_INDEX(taskID) < g_taskMaxNum)
#define OS_TASK_ID_CHECK(taskID) (OS_TSK_GET_INDEX(taskID) < g_taskMaxNum)
/**
* @ingroup los_task
......@@ -409,6 +409,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsTaskInit(VOID)
UINT32 size;
UINT32 index;
g_taskMaxNum = LOSCFG_BASE_CORE_TSK_LIMIT + 1; /* Reserved 1 for IDLE */
size = (g_taskMaxNum + 1) * sizeof(LosTaskCB);
g_taskCBArray = (LosTaskCB *)LOS_MemAlloc(m_aucSysMem0, size);
if (g_taskCBArray == NULL) {
......@@ -856,7 +857,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskResume(UINT32 taskID)
UINT32 retErr = OS_ERROR;
BOOL needSched = FALSE;
if (taskID > LOSCFG_BASE_CORE_TSK_LIMIT) {
if (!OS_TASK_ID_CHECK(taskID)) {
return LOS_ERRNO_TSK_ID_INVALID;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册