提交 e1b36bfe 编写于 作者: O openharmony_ci 提交者: Gitee

!594 临终遗言重定向内容缺失task相关信息,对应的shell命令中申请的内存需要cacheline对齐

Merge pull request !594 from zhushengle/excinfo
...@@ -1053,10 +1053,12 @@ STATIC VOID OsCheckAllCpuStatus(VOID) ...@@ -1053,10 +1053,12 @@ STATIC VOID OsCheckAllCpuStatus(VOID)
g_currHandleExcCpuID = currCpuID; g_currHandleExcCpuID = currCpuID;
g_currHandleExcPID = OsCurrProcessGet()->processID; g_currHandleExcPID = OsCurrProcessGet()->processID;
LOS_SpinUnlock(&g_excSerializerSpin); LOS_SpinUnlock(&g_excSerializerSpin);
#ifndef LOSCFG_SAVE_EXCINFO
if (g_excFromUserMode[currCpuID] == FALSE) { if (g_excFromUserMode[currCpuID] == FALSE) {
target = (UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuID)); target = (UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuID));
HalIrqSendIpi(target, LOS_MP_IPI_HALT); HalIrqSendIpi(target, LOS_MP_IPI_HALT);
} }
#endif
} else if (g_excFromUserMode[currCpuID] == TRUE) { } else if (g_excFromUserMode[currCpuID] == TRUE) {
/* Both cores raise exceptions, and the current core is a user-mode exception. /* Both cores raise exceptions, and the current core is a user-mode exception.
* Both cores are abnormal and come from the same process * Both cores are abnormal and come from the same process
...@@ -1081,11 +1083,12 @@ STATIC VOID OsCheckAllCpuStatus(VOID) ...@@ -1081,11 +1083,12 @@ STATIC VOID OsCheckAllCpuStatus(VOID)
while (1) {} while (1) {}
} }
} }
#ifndef LOSCFG_SAVE_EXCINFO
/* use halt ipi to stop other active cores */ /* use halt ipi to stop other active cores */
if (g_excFromUserMode[ArchCurrCpuid()] == FALSE) { if (g_excFromUserMode[ArchCurrCpuid()] == FALSE) {
WaitAllCpuStop(currCpuID); WaitAllCpuStop(currCpuID);
} }
#endif
} }
#endif #endif
......
...@@ -170,16 +170,17 @@ VOID OsRecordExcInfoTime(VOID) ...@@ -170,16 +170,17 @@ VOID OsRecordExcInfoTime(VOID)
#ifdef LOSCFG_SHELL #ifdef LOSCFG_SHELL
INT32 OsShellCmdReadExcInfo(INT32 argc, CHAR **argv) INT32 OsShellCmdReadExcInfo(INT32 argc, CHAR **argv)
{ {
#define EXCINFO_ALIGN_SIZE 64
UINT32 recordSpace = GetRecordSpace(); UINT32 recordSpace = GetRecordSpace();
(VOID)argc; (VOID)argc;
(VOID)argv; (VOID)argv;
CHAR *buf = (CHAR*)LOS_MemAlloc((void *)OS_SYS_MEM_ADDR, recordSpace + 1); CHAR *buf = (CHAR *)LOS_MemAllocAlign((VOID *)OS_SYS_MEM_ADDR, recordSpace + 1, EXCINFO_ALIGN_SIZE);
if (buf == NULL) { if (buf == NULL) {
return LOS_NOK; return LOS_NOK;
} }
(void)memset_s(buf, recordSpace + 1, 0, recordSpace + 1); (VOID)memset_s(buf, recordSpace + 1, 0, recordSpace + 1);
log_read_write_fn hook = GetExcInfoRW(); log_read_write_fn hook = GetExcInfoRW();
if (hook != NULL) { if (hook != NULL) {
......
...@@ -202,12 +202,22 @@ __attribute__ ((noinline)) VOID dprintf(const CHAR *fmt, ...) ...@@ -202,12 +202,22 @@ __attribute__ ((noinline)) VOID dprintf(const CHAR *fmt, ...)
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
OsVprintf(fmt, ap, CONSOLE_OUTPUT); OsVprintf(fmt, ap, CONSOLE_OUTPUT);
#ifdef LOSCFG_SAVE_EXCINFO
if (OsGetSystemStatus() == OS_SYSTEM_EXC_CURR_CPU) {
WriteExcBufVa(fmt, ap);
}
#endif
va_end(ap); va_end(ap);
} }
VOID LkDprintf(const CHAR *fmt, va_list ap) VOID LkDprintf(const CHAR *fmt, va_list ap)
{ {
OsVprintf(fmt, ap, CONSOLE_OUTPUT); OsVprintf(fmt, ap, CONSOLE_OUTPUT);
#ifdef LOSCFG_SAVE_EXCINFO
if (OsGetSystemStatus() == OS_SYSTEM_EXC_CURR_CPU) {
WriteExcBufVa(fmt, ap);
}
#endif
} }
#ifdef LOSCFG_SHELL_DMESG #ifdef LOSCFG_SHELL_DMESG
...@@ -273,6 +283,11 @@ VOID LOS_LkPrint(INT32 level, const CHAR *func, INT32 line, const CHAR *fmt, ... ...@@ -273,6 +283,11 @@ VOID LOS_LkPrint(INT32 level, const CHAR *func, INT32 line, const CHAR *fmt, ...
va_start(ap, fmt); va_start(ap, fmt);
OsVprintf(fmt, ap, CONSOLE_OUTPUT); OsVprintf(fmt, ap, CONSOLE_OUTPUT);
#ifdef LOSCFG_SAVE_EXCINFO
if (OsGetSystemStatus() == OS_SYSTEM_EXC_CURR_CPU) {
WriteExcBufVa(fmt, ap);
}
#endif
va_end(ap); va_end(ap);
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册