提交 ee8ae574 编写于 作者: Z zhangfanfan2 提交者: Gitee

回退IsValidFP的修改提交

上级 78a6bd94
......@@ -574,12 +574,8 @@ STATIC VOID OsUserExcHandle(ExcContext *excBufAddr)
PrintExcInfo("User mode exception ends unscheduled!\n");
}
/*
* This function is used to determine whether the first input parameter is a valid virtual address.
* If it is, it is converted into a kernel virtual address and the converted kernel virtual address
* is used as an output parameter.
*/
STATIC INLINE BOOL IsValidVaddr(UINTPTR regFP, UINTPTR start, UINTPTR end, vaddr_t *vaddr)
/* this function is used to validate fp or validate the checking range start and end. */
STATIC INLINE BOOL IsValidFP(UINTPTR regFP, UINTPTR start, UINTPTR end, vaddr_t *vaddr)
{
VADDR_T kvaddr = regFP;
......@@ -622,7 +618,7 @@ STATIC INLINE BOOL FindSuitableStack(UINTPTR regFP, UINTPTR *start, UINTPTR *end
taskCB = OsCurrTaskGet();
stackStart = taskCB->userMapBase;
stackEnd = taskCB->userMapBase + taskCB->userMapSize;
if (IsValidVaddr(regFP, stackStart, stackEnd, &kvaddr) == TRUE) {
if (IsValidFP(regFP, stackStart, stackEnd, &kvaddr) == TRUE) {
found = TRUE;
goto FOUND;
}
......@@ -638,7 +634,7 @@ STATIC INLINE BOOL FindSuitableStack(UINTPTR regFP, UINTPTR *start, UINTPTR *end
stackStart = taskCB->topOfStack;
stackEnd = taskCB->topOfStack + taskCB->stackSize;
if (IsValidVaddr(regFP, stackStart, stackEnd, &kvaddr) == TRUE) {
if (IsValidFP(regFP, stackStart, stackEnd, &kvaddr) == TRUE) {
found = TRUE;
goto FOUND;
}
......@@ -649,7 +645,7 @@ STATIC INLINE BOOL FindSuitableStack(UINTPTR regFP, UINTPTR *start, UINTPTR *end
stack = &g_excStack[index];
stackStart = (UINTPTR)stack->stackTop;
stackEnd = stackStart + LOSCFG_KERNEL_CORE_NUM * stack->stackSize;
if (IsValidVaddr(regFP, stackStart, stackEnd, &kvaddr) == TRUE) {
if (IsValidFP(regFP, stackStart, stackEnd, &kvaddr) == TRUE) {
found = TRUE;
goto FOUND;
}
......@@ -685,23 +681,23 @@ VOID BackTraceSub(UINTPTR regFP)
* will still be stored and updated. In that case we needs to find the right position of frame pointer.
*/
tmpFP = *(UINTPTR *)(UINTPTR)kvaddr;
if (IsValidVaddr(tmpFP, stackStart, stackEnd, NULL) == TRUE) {
if (IsValidFP(tmpFP, stackStart, stackEnd, NULL) == TRUE) {
backFP = tmpFP;
PrintExcInfo("traceback fp fixed, trace using fp = 0x%x\n", backFP);
}
while (IsValidVaddr(backFP, stackStart, stackEnd, &kvaddr) == TRUE) {
while (IsValidFP(backFP, stackStart, stackEnd, &kvaddr) == TRUE) {
tmpFP = backFP;
#ifdef LOSCFG_COMPILER_CLANG_LLVM
backFP = *(UINTPTR *)(UINTPTR)kvaddr;
if (IsValidVaddr(tmpFP + POINTER_SIZE, stackStart, stackEnd, &kvaddr) == FALSE) {
if (IsValidFP(tmpFP + POINTER_SIZE, stackStart, stackEnd, &kvaddr) == FALSE) {
PrintExcInfo("traceback backLR check failed, backLP: 0x%x\n", tmpFP + POINTER_SIZE);
return;
}
backLR = *(UINTPTR *)(UINTPTR)kvaddr;
#else
backLR = *(UINTPTR *)(UINTPTR)kvaddr;
if (IsValidVaddr(tmpFP - POINTER_SIZE, stackStart, stackEnd, &kvaddr) == FALSE) {
if (IsValidFP(tmpFP - POINTER_SIZE, stackStart, stackEnd, &kvaddr) == FALSE) {
PrintExcInfo("traceback backFP check failed, backFP: 0x%x\n", tmpFP - POINTER_SIZE);
return;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册