74 if (*stackTop == OS_STACK_MAGIC_WORD) {
76 while ((tmp <
stackBottom) && (*tmp == OS_STACK_INIT)) {
80 *peakUsed = (size == 0) ? size : (size +
sizeof(
CHAR *));
83 *peakUsed = OS_INVALID_WATERLINE;
98 for (cpuid = 0; cpuid < LOSCFG_KERNEL_CORE_NUM; cpuid++) {
100 if (*stackTop != OS_STACK_MAGIC_WORD) {
101 PRINT_ERR(
"cpu:%u %s overflow , magic word changed to 0x%x\n",
102 LOSCFG_KERNEL_CORE_NUM - 1 - cpuid,
g_stackInfo[index].stackName, *stackTop);
121 PrintExcInfo(
"\n stack name cpu id stack addr total size used size\n"
122 " ---------- ------ --------- -------- --------\n");
123 for (index = 0; index <
g_stackNum; index++) {
124 for (cpuid = 0; cpuid < LOSCFG_KERNEL_CORE_NUM; cpuid++) {
148 errno_t ret = memset_s(stacktop, stacksize, (
INT32)OS_STACK_INIT, stacksize);
150 *((
UINTPTR *)stacktop) = OS_STACK_MAGIC_WORD;
154#ifdef LOSCFG_SHELL_CMD_DEBUG
@ CMD_TYPE_EX
不支持标准命令参数输入,会把用户填写的命令关键字屏蔽掉,例如:输入ls /ramfs,传入给注册函数的参数只有/ramfs,而ls命令关键字并不会被传入。
macro EXC_SP_SET stackBottom
macro EXC_SP_SET stackSize
UINT32 OsStackWaterLineGet(const UINTPTR *stackBottom, const UINTPTR *stackTop, UINT32 *peakUsed)
获取栈的吃水线
VOID PrintExcInfo(const CHAR *fmt,...)
打印异常信息
const StackInfo * g_stackInfo
CPU所有工作模式的栈信息
VOID OsExcStackInfoReg(const StackInfo *stackInfo, UINT32 stackNum)
注册栈信息
VOID OsExcStackCheck(VOID)
异常情况下的栈检查,主要就是检查栈顶值有没有被改写
VOID OsStackInit(VOID *stacktop, UINT32 stacksize)
task栈的初始化,设置固定的值. 0xcccccccc 和 0xcacacaca
SHELLCMD_ENTRY(stack_shellcmd, CMD_TYPE_EX, "stack", 1,(CmdCallBackFunc) OsExcStackInfo)
VOID OsExcStackInfo(VOID)
打印栈的信息 把每个CPU的栈信息打印出来
u32_t(* CmdCallBackFunc)(u32_t argc, const char **argv)