88#ifdef LOSCFG_SAVE_EXCINFO
93#include "los_coredump.h"
105#ifdef LOSCFG_KERNEL_DYNLOAD
116#ifdef LOSCFG_BLACKBOX
120#define INVALID_CPUID 0xFFFF
121#define OS_EXC_VMM_NO_REGION 0x0U
122#define OS_EXC_VMM_ALL_REGION 0x1U
131#ifdef LOSCFG_KERNEL_SMP
137#define OS_MAX_BACKTRACE 15U
141#define INSTR_SET_MASK 0x01000020U
142#define THUMB_INSTR_LEN 2U
143#define ARM_INSTR_LEN 4U
144#define POINTER_SIZE 4U
146#define FSR_FLAG_OFFSET_BIT 10U
147#define FSR_BITS_BEGIN_BIT 3U
149#define GET_FS(fsr) (((fsr)&0xFU) | (((fsr) & (1U << 10)) >> 6))
150#define GET_WNR(dfsr) ((dfsr) & (1U << 11))
152#define IS_VALID_ADDR(ptr) (((ptr) >= g_minAddr) && \
153 ((ptr) <= g_maxAddr) && \
154 (IS_ALIGNED((ptr), sizeof(CHAR *))))
177 {&
__svc_stack, OS_EXC_SVC_STACK_SIZE,
"svc_stack"},
186 if (cpuid == INVALID_CPUID) {
187 flag = OS_SYSTEM_NORMAL;
189 flag = OS_SYSTEM_EXC_CURR_CPU;
191 flag = OS_SYSTEM_EXC_OTHER_CPU;
202 PrintExcInfo(
"Translation fault, %s\n", (bitsFS & 0x2) ?
"page" :
"section");
206 PrintExcInfo(
"Domain fault, %s\n", (bitsFS & 0x2) ?
"page" :
"section");
210 PrintExcInfo(
"Permission fault, %s\n", (bitsFS & 0x2) ?
"page" :
"section");
214 "Check IFSR and DFSR in ARM Architecture Reference Manual.\n",
225 UINT32 bitsFS = GET_FS(regIFSR);
234 UINT32 bitWnR = GET_WNR(regDFSR);
235 UINT32 bitsFS = GET_FS(regDFSR);
243 if (bitsFS == 0x01) {
251#ifdef LOSCFG_KERNEL_VM
263 BOOL instructionFault = FALSE;
269 PRINT_INFO(
"page fault entry!!!\n");
271 return LOS_ERRNO_VM_NOT_FOUND;
273#if defined(LOSCFG_KERNEL_SMP) && defined(LOSCFG_DEBUG_VERSION)
278 PrintExcInfo(
"[ERR][%s] may be held scheduler lock when entering [%s] on cpu [%u]\n",
284 if (excType == OS_EXCEPT_PREFETCH_ABORT) {
285 instructionFault = TRUE;
287 write = !!BIT_GET(fsr, WNR_BIT);
290 fsrFlag = ((BIT_GET(fsr, FSR_FLAG_OFFSET_BIT) ? 0b10000 : 0) | BITS_GET(fsr, FSR_BITS_BEGIN_BIT, 0));
300 BOOL user = (frame->
regCPSR & CPSR_MODE_MASK) == CPSR_MODE_USR;
301 pfFlags |= write ? VM_MAP_PF_FLAG_WRITE : 0;
302 pfFlags |= user ? VM_MAP_PF_FLAG_USER : 0;
303 pfFlags |= instructionFault ? VM_MAP_PF_FLAG_INSTRUCTION : 0;
304 pfFlags |= VM_MAP_PF_FLAG_NOT_PRESENT;
315#if defined(LOSCFG_KERNEL_SMP) && defined(LOSCFG_DEBUG_VERSION)
329 if ((excType == OS_EXCEPT_UNDEF_INSTR) || (excType == OS_EXCEPT_SWI)) {
330 if ((excBufAddr->
regCPSR & INSTR_SET_MASK) == 0) {
331 excBufAddr->
PC = excBufAddr->
PC - ARM_INSTR_LEN;
332 }
else if ((excBufAddr->
regCPSR & INSTR_SET_MASK) == 0x20) {
333 excBufAddr->
PC = excBufAddr->
PC - THUMB_INSTR_LEN;
337 if (excType == OS_EXCEPT_PREFETCH_ABORT) {
338 PrintExcInfo(
"prefetch_abort fault fsr:0x%x, far:0x%0+8x\n", fsr, far);
340 }
else if (excType == OS_EXCEPT_DATA_ABORT) {
341 PrintExcInfo(
"data_abort fsr:0x%x, far:0x%0+8x\n", fsr, far);
349 "undefined instruction",
350 "software interrupt",
358#ifdef LOSCFG_KERNEL_VM
361 struct Vnode *curVnode = NULL;
362 struct Vnode *lastVnode = NULL;
366 if ((region == NULL) || (runProcess == NULL)) {
376 curRegion = lastRegion;
383 }
while (curVnode == lastVnode);
386#ifdef LOSCFG_KERNEL_DYNLOAD
387 if (curRegion->
range.
base == EXEC_MMAP_BASE) {
409#ifdef LOSCFG_KERNEL_VM
410 "process aspace = 0x%08x -> 0x%08x\n"
417#ifdef LOSCFG_KERNEL_VM
424#ifdef LOSCFG_KERNEL_VM
436#ifdef LOSCFG_KERNEL_VM
441 if (region != NULL) {
449 if (region != NULL) {
485 excBufAddr->
R0, excBufAddr->
R1, excBufAddr->
R2, excBufAddr->
R3,
486 excBufAddr->
R4, excBufAddr->
R5, excBufAddr->
R6);
494 excBufAddr->
R7, excBufAddr->
R8, excBufAddr->
R9, excBufAddr->
R10,
514#ifdef LOSCFG_KERNEL_VM
517 INT32 i, numPages, pageCount;
518 paddr_t addr, oldAddr, startVaddr, startPaddr;
520 BOOL mmuFlag = FALSE;
522 numPages = region->
range.
size >> PAGE_SHIFT;
524 for (pageCount = 0, startPaddr = 0, startVaddr = 0, i = 0; i < numPages; i++) {
525 pageBase = region->
range.
base + i * PAGE_SIZE;
528 if (startPaddr == 0) {
531 }
else if (startPaddr == 0) {
532 startVaddr = pageBase;
539 }
else if (addr == (oldAddr + PAGE_SIZE)) {
542 if (i < (numPages - 1)) {
546 if (mmuFlag == TRUE) {
565 RB_SCAN_SAFE(&runspace->
regionRbTree, pstRbNodeTemp, pstRbNodeNext)
568 if (vmmFlags == OS_EXC_VMM_ALL_REGION) {
573 RB_SCAN_SAFE_END(&space->regionRbTree, pstRbNodeTemp, pstRbNodeNext)
582 if (runProcess == NULL) {
592 runspace = runProcess->
vmSpace;
611 const UINT32 *excReg = NULL;
616 for (excReg = &(excBufAddr->
R0); count < COM_REGS; excReg++, count++) {
617 if (IS_VALID_ADDR(*excReg)) {
618 PrintExcInfo(
"\ndump mem around R%u:%p", count, (*excReg));
622 for (excReg = &(excBufAddr->
R4); count < DUMPREGS; excReg++, count++) {
623 if (IS_VALID_ADDR(*excReg)) {
624 PrintExcInfo(
"\ndump mem around R%u:%p", count, (*excReg));
628 if (IS_VALID_ADDR(excBufAddr->
R12)) {
632 if (IS_VALID_ADDR(excBufAddr->
SP)) {
645#ifdef LOSCFG_KERNEL_SMP
662#ifdef LOSCFG_KERNEL_SMP
676#ifdef LOSCFG_KERNEL_SMP
682#ifdef LOSCFG_BLACKBOX
685 SCHEDULER_LOCK(intSave);
686#ifdef LOSCFG_SAVE_EXCINFO
695 SCHEDULER_UNLOCK(intSave);
700 SCHEDULER_UNLOCK(intSave);
711 PrintExcInfo(
"User mode exception ends unscheduled!\n");
720 if (!((regFP > start) && (regFP < end) && IS_ALIGNED(regFP,
sizeof(
CHAR *)))) {
724#ifdef LOSCFG_KERNEL_VM
729 if (runspace == NULL) {
749 UINT32 index, stackStart, stackEnd;
755#ifdef LOSCFG_KERNEL_VM
760 if (
IsValidFP(regFP, stackStart, stackEnd, &kvaddr) == TRUE) {
777 if (
IsValidFP(regFP, stackStart, stackEnd, &kvaddr) == TRUE) {
787 stackEnd = stackStart + LOSCFG_KERNEL_CORE_NUM * stack->
stackSize;
788 if (
IsValidFP(regFP, stackStart, stackEnd, &kvaddr) == TRUE) {
809#ifdef LOSCFG_KERNEL_VM
811 const CHAR *name = NULL;
823 if (region == NULL) {
833 if (strcmp(name,
"/lib/libc.so") != 0) {
834 PRINT_ERR(
"ip = 0x%x, %s\n", info->
ip, name);
837 info->
len = strlen(name);
838 if (strncpy_s(info->
f_path, REGION_PATH_MAX, name, REGION_PATH_MAX - 1) != EOK) {
841 PRINT_ERR(
"copy f_path failed, %s\n", name);
860 if (callChain == NULL) {
873 if (
IsValidFP(tmpFP, stackStart, stackEnd, NULL) == TRUE) {
875 if (callChain == NULL) {
876 PrintExcInfo(
"traceback fp fixed, trace using fp = 0x%x\n", backFP);
880 while (
IsValidFP(backFP, stackStart, stackEnd, &kvaddr) == TRUE) {
882#ifdef LOSCFG_COMPILER_CLANG_LLVM
884 if (
IsValidFP(tmpFP + POINTER_SIZE, stackStart, stackEnd, &kvaddr) == FALSE) {
885 if (callChain == NULL) {
886 PrintExcInfo(
"traceback backLR check failed, backLP: 0x%x\n", tmpFP + POINTER_SIZE);
893 if (
IsValidFP(tmpFP - POINTER_SIZE, stackStart, stackEnd, &kvaddr) == FALSE) {
894 if (callChain == NULL) {
895 PrintExcInfo(
"traceback backFP check failed, backFP: 0x%x\n", tmpFP - POINTER_SIZE);
903 if (callChain == NULL) {
904 PrintExcInfo(
"traceback %u -- lr = 0x%x fp = 0x%x ", count, backLR, backFP);
906#ifdef LOSCFG_KERNEL_VM
915 (VOID)memcpy_s(&callChain[count],
sizeof(
IpInfo), &info,
sizeof(
IpInfo));
918 if ((count == maxDepth) || (backFP == tmpFP)) {
944 OsExcType(excType, excBufAddr, far, fsr);
952#ifndef LOSCFG_DEBUG_VERSION
955#ifdef LOSCFG_KERNEL_VM
959#ifndef LOSCFG_DEBUG_VERSION
967#ifdef LOSCFG_COREDUMP
968 LOS_CoreDumpV2(excType, excBufAddr);
982 "runTask->topOfStack = 0x%x\n"
983 "text_start:0x%x,text_end:0x%x\n",
986 while ((stackPointer > (
UINT32 *)runTask->
topOfStack) && (count < OS_MAX_BACKTRACE)) {
989 IS_ALIGNED((*stackPointer), POINTER_SIZE)) {
992 IS_ALIGNED((*(stackPointer - 1)), POINTER_SIZE)) {
994 PrintExcInfo(
"traceback %u -- lr = 0x%x\n", count, *stackPointer);
1011 if (OS_TID_CHECK_INVALID(taskID)) {
1012 PRINT_ERR(
"\r\nTask ID is invalid!\n");
1015 taskCB = OS_TCB_FROM_TID(taskID);
1017 PRINT_ERR(
"\r\nThe task is not created!\n");
1020 PRINTK(
"TaskName = %s\n", taskCB->
taskName);
1021 PRINTK(
"TaskID = 0x%x\n", taskCB->
taskID);
1038 excBufAddr->
PC -= 4;
1040 if (gdb_undef_hook(excBufAddr, OS_EXCEPT_UNDEF_INSTR)) {
1046 g_excHook(OS_EXCEPT_UNDEF_INSTR, excBufAddr, 0, 0);
1052#if __LINUX_ARM_ARCH__ >= 7
1058 excBufAddr->
PC -= 4;
1060 if (gdbhw_hook(excBufAddr, OS_EXCEPT_PREFETCH_ABORT)) {
1067 g_excHook(OS_EXCEPT_PREFETCH_ABORT, excBufAddr, far, fsr);
1078 excBufAddr->
PC -= 8;
1080 if (gdbhw_hook(excBufAddr, OS_EXCEPT_DATA_ABORT)) {
1087 g_excHook(OS_EXCEPT_DATA_ABORT, excBufAddr, far, fsr);
1094#ifdef LOSCFG_KERNEL_SMP
1095#define EXC_WAIT_INTER 50U
1096#define EXC_WAIT_TIME 2000U
1104 while (
time < EXC_WAIT_TIME) {
1105 for (i = 0; i < LOSCFG_KERNEL_CORE_NUM; i++) {
1108 time += EXC_WAIT_INTER;
1113 if (i == LOSCFG_KERNEL_CORE_NUM) {
1145 LOCKDEP_CLEAR_LOCKS();
1153#ifndef LOSCFG_SAVE_EXCINFO
1155 target = (
UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuid));
1176 target = (
UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuid));
1183#ifndef LOSCFG_SAVE_EXCINFO
1194#ifdef LOSCFG_KERNEL_SMP
1203 if ((excBufAddr->
regCPSR & CPSR_MASK_MODE) == CPSR_USER_MODE) {
1205 g_maxAddr = USER_ASPACE_BASE + USER_ASPACE_SIZE;
1209 g_maxAddr = KERNEL_ASPACE_BASE + KERNEL_ASPACE_SIZE;
1215#ifdef LOSCFG_KERNEL_SMP
1225#ifdef LOSCFG_BLACKBOX
1226#ifdef LOSCFG_SAVE_EXCINFO
1230#ifdef LOSCFG_KERNEL_VM
1233#ifdef LOSCFG_DEBUG_VERSION
1234 VADDR_T vaddr = ROUNDDOWN(far, PAGE_SIZE);
1236 if (space != NULL) {
1240 PrintExcInfo(
"##################excFrom: User!####################\n");
1244 PrintExcInfo(
"##################excFrom: kernel!###################\n");
1248#ifdef LOSCFG_SAVE_EXCINFO
1271#ifdef LOSCFG_SAVE_EXCINFO
1284#ifdef LOSCFG_KERNEL_SMP
1288#ifdef LOSCFG_SAVE_EXCINFO
1294#ifdef LOSCFG_SAVE_EXCINFO
1296#ifndef LOSCFG_BLACKBOX
1304 g_excHook(excType, excBufAddr, far, fsr);
1309#ifdef LOSCFG_SAVE_EXCINFO
1319#ifdef LOSCFG_SHELL_CMD_DEBUG
1327#ifdef LOSCFG_BLACKBOX
1339 __asm__ __volatile__(
"swi 0");
1349 LOS_Panic(
"stack-protector: Kernel stack is corrupted in: %p\n",
1350 __builtin_return_address(0));
1357 UINT32 stackStart, stackEnd;
1359 UINTPTR framePtr, tmpFramePtr, linkReg;
1365 if (LRSize < recordCount) {
1366 recordCount = LRSize;
1371 stackEnd = stackStart + taskCB->
stackSize;
1374 while ((framePtr > stackStart) && (framePtr < stackEnd) && IS_ALIGNED(framePtr,
sizeof(
CHAR *))) {
1375 tmpFramePtr = framePtr;
1376#ifdef LOSCFG_COMPILER_CLANG_LLVM
1379 linkReg = *(
UINTPTR *)framePtr;
1381 if (index >= jumpCount) {
1382 LR[count++] = linkReg;
1383 if (count == recordCount) {
1388#ifdef LOSCFG_COMPILER_CLANG_LLVM
1389 framePtr = *(
UINTPTR *)framePtr;
1396 if (count < recordCount) {
STATIC INLINE UINT32 OsArmReadDfar(VOID)
STATIC INLINE UINT32 OsArmReadIfsr(VOID)
STATIC INLINE UINT32 OsArmReadIfar(VOID)
STATIC INLINE UINT32 OsArmReadDfsr(VOID)
STATIC INLINE VOID OsArmWriteTlbimvaais(UINT32 val)
macro EXC_SP_SET stackBottom
VOID OsWakeConsoleSendTask(VOID)
唤醒控制台发送任务
VOID OsWaitConsoleSendTaskPend(UINT32 taskID)
VOID HalIrqSendIpi(UINT32 target, UINT32 ipi)
VOID(* log_read_write_fn)(UINT32 startAddr, UINT32 space, UINT32 rwFlag, CHAR *buf)
define the type of functions for reading or writing exception information.
LITE_OS_SEC_TEXT_INIT UINT32 LOS_ExcRegHook(EXC_PROC_FUNC excHook)
注册异常处理钩子
VOID LOS_RecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 recordCount, UINT32 jumpCount)
record LR function.
VOID OsTaskBackTrace(UINT32 taskID)
Kernel task backtrace function.
VOID(* EXC_PROC_FUNC)(UINT32, ExcContext *, UINT32, UINT32)
Define an exception handling function hook.
STATIC INLINE UINTPTR Get_Fp(VOID)
Kernel FP Register address obtain function.
NORETURN VOID LOS_Panic(const CHAR *fmt,...)
Kernel panic function.
VOID OsBackTrace(VOID)
Kernel backtrace function.
size_t g_intCount[LOSCFG_KERNEL_CORE_NUM]
记录每个CPUcore的中断数量
STATIC INLINE VOID LOS_IntRestore(UINT32 intSave)
Restore interrupts. | 恢复到使用LOS_IntLock关闭所有中断之前的状态
STATIC INLINE UINT32 LOS_IntLock(VOID)
Disable all interrupts. | 关闭当前处理器所有中断响应
LITE_OS_SEC_BSS UINT32 g_taskMaxNum
任务最大数量 默认128个
LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskDelete(UINT32 taskID)
Delete a task.
LITE_OS_SEC_BSS LosTaskCB * g_taskCBArray
外部变量 任务池 默认128个
LITE_OS_SEC_TEXT_MINOR VOID LOS_Mdelay(UINT32 msecs)
以ms为单位的忙等,但可以被优先级更高的任务抢占
https://blog.csdn.net/qq_38410730/article/details/81036768
STATUS_T LOS_ArchMmuQuery(const LosArchMmu *archMmu, VADDR_T vaddr, PADDR_T *paddr, UINT32 *flags)
LOS_ArchMmuQuery 获取进程空间虚拟地址对应的物理地址以及映射属性。 本函数是内核高频函数,通过MMU查询虚拟地址是否映射过,带走映射的物理地址和权限
int BBoxNotifyError(const char event[EVENT_MAX_LEN], const char module[MODULE_MAX_LEN], const char errorDesc[ERROR_DESC_MAX_LEN], int needSysReset)
SystemRebootFunc OsGetRebootHook(VOID)
获取系统重启钩子函数
VOID(* SystemRebootFunc)(VOID)
STATIC UINT32 g_currHandleExcCpuid
STATIC VOID WaitAllCpuStop(UINT32 cpuid)
等待所有CPU停止
STATIC VOID OsDumpProcessUsedMemRegion(LosProcessCB *runProcess, LosVmSpace *runspace, UINT16 vmmFlags)
dump 进程使用的内存线性区
STATIC VOID OsUserExcHandle(ExcContext *excBufAddr)
用户态异常处理函数
VOID OsCallStackInfo(VOID)
打印调用栈信息
STATIC INT32 OsDecodeDataFSR(UINT32 regDFSR)
STATIC VOID OsCheckAllCpuStatus(VOID)
检查所有CPU的状态
BOOL g_excFromUserMode[LOSCFG_KERNEL_CORE_NUM]
记录CPU core 异常来自用户态还是内核态 TRUE为用户态,默认为内核态
VOID OsDumpContextMem(const ExcContext *excBufAddr)
dump 上下文内存,注意内核异常不能简单的映射理解为应用的异常,异常对内核来说是一个很常见操作, 比如任务的切换对内核来说就是一个异常处理
STATIC const StackInfo g_excStack[]
VOID BackTrace(UINT32 regFP)
打印调用栈信息
STATIC VOID OsSysStateRestore(UINT32 intCount, UINT32 lockCount)
UINT32 OsGetSystemStatus(VOID)
获取系统状态
STATIC const CHAR * g_excTypeString[]
LITE_OS_SEC_TEXT VOID STATIC OsExcPriorDisposal(ExcContext *excBufAddr)
执行期间的优先处理 excBufAddr为CPU异常上下文,
UINT32 OsArmSharedPageFault(UINT32 excType, ExcContext *frame, UINT32 far, UINT32 fsr)
共享页缺失异常
STATIC VOID OsExcType(UINT32 excType, ExcContext *excBufAddr, UINT32 far, UINT32 fsr)
异常类型
STATIC VOID OsCheckCpuStatus(VOID)
STATIC VOID OsDumpExcVaddrRegion(LosVmSpace *space, LosVmMapRegion *region)
dump 虚拟空间下异常虚拟地址线性区
STATIC INT32 OsDecodeFS(UINT32 bitsFS)
STATIC VOID OsSysStateSave(UINT32 *intCount, UINT32 *lockCount)
BOOL OsGetUsrIpInfo(UINTPTR ip, IpInfo *info)
UINT32 g_curNestCount[LOSCFG_KERNEL_CORE_NUM]
记录当前嵌套异常的数量
STATIC INLINE BOOL IsValidFP(UINTPTR regFP, UINTPTR start, UINTPTR end, vaddr_t *vaddr)
此函数用于验证fp或验证检查开始和结束范围
STATIC EXC_PROC_FUNC g_excHook
全局异常处理钩子
STATIC VOID OsExcRestore(VOID)
异常恢复,继续执行
VOID OsPrefetchAbortExcHandleEntry(ExcContext *excBufAddr)
预取指令异常处理函数,由汇编调用 见于 los_hw_exc.s
STATIC INT32 OsDecodeInstructionFSR(UINT32 regIFSR)
VOID BackTraceSub(UINTPTR regFP)
STATIC VADDR_T OsGetTextRegionBase(LosVmMapRegion *region, LosProcessCB *runProcess)
VOID OsExcHook(UINT32 excType, ExcContext *excBufAddr, UINT32 far, UINT32 fsr)
由注册后回调,发送异常情况下会回调这里执行,见于 OsUndefIncExcHandleEntry, OsExcHandleEntry ==函数
VOID __stack_chk_fail(VOID)
STATIC VOID OsDumpProcessUsedMemNode(UINT16 vmmFlags)
dump 进程使用的内存节点
VOID OsUndefIncExcHandleEntry(ExcContext *excBufAddr)
未定义的异常处理函数,由汇编调用 见于 los_hw_exc.s
STATIC VOID OsExcSysInfo(UINT32 excType, const ExcContext *excBufAddr)
打印异常系统信息
LITE_OS_SEC_TEXT_INIT STATIC VOID OsPrintExcHead(UINT32 far)
异常信息头部打印
VOID OsExcInit(VOID)
异常接管模块的初始化
STATIC VOID OsWaitOtherCoresHandleExcEnd(UINT32 currCpuid)
VOID OsDataAbortExcHandleEntry(ExcContext *excBufAddr)
数据中止异常处理函数,由汇编调用 见于 los_hw_exc.s
UINT32 BackTraceGet(UINTPTR regFP, IpInfo *callChain, UINT32 maxDepth)
EXC_PROC_FUNC OsExcRegHookGet(VOID)
获取hook函数
USED UINT32 __stack_chk_guard
STATIC INLINE BOOL FindSuitableStack(UINTPTR regFP, UINTPTR *start, UINTPTR *end, vaddr_t *vaddr)
找到一个合适的栈
STATIC UINT32 g_currHandleExcPID
STATIC UINT32 g_nextExcWaitCpu
__attribute__((noinline))
可变参数,输出到控制台
STATIC VOID OsExcRegsInfo(const ExcContext *excBufAddr)
异常情况下打印各寄存器的信息
STATIC SPIN_LOCK_INIT(g_excSerializerSpin)
LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAddr, UINT32 far, UINT32 fsr)
BOOL OsSystemExcIsReset(VOID)
UINT32 GetExcInfoIndex(VOID)
获取异常信息索引位
CHAR * GetExcInfoBuf(VOID)
获取异常信息的缓存
UINT32 GetRecordAddr(VOID)
UINT32 GetRecordSpace(VOID)
log_read_write_fn GetExcInfoRW(VOID)
获取异常信息读写函数
VOID OsRecordExcInfoTime(VOID)
记录异常信息产生的时间
VOID SetExcInfoIndex(UINT32 index)
设置异常信息索引位
STATIC INLINE VOID ArchIrqDisable(VOID)
STATIC INLINE UINT32 ArchCurrCpuid(VOID)
STATIC INLINE VOID ArchIrqEnable(VOID)
UINT32 OsShellCmdMemCheck(INT32 argc, const CHAR *argv[])
VOID OsDumpMemByte(size_t length, UINTPTR addr)
@ LOS_MP_IPI_HALT
!< 调度CPU
STATIC INLINE UINT32 OsCpuStatusIsHalt(UINT16 cpuid)
@ CPU_EXC
cpu in the exc | CPU处于异常状态
@ CPU_RUNNING
cpu is running | CPU正在运行状态
VOID OsAllCpuStatusOutput(VOID)
STATIC INLINE VOID OsCpuStatusSet(ExcFlag flag)
VOID OsVprintf(const CHAR *fmt, va_list ap, OutputType type)
printf由 print 和 format 两个单词构成,格式化输出函数, 一般用于向标准输出设备按规定格式输出信息
VOID PrintExcInfo(const CHAR *fmt,...)
打印异常信息
LITE_OS_SEC_TEXT VOID LOS_Exit(INT32 status)
LOS_Exit 进程退出
STATIC INLINE BOOL OsProcessIsUserMode(const LosProcessCB *processCB)
STATIC INLINE VOID OsProcessExitCodeSignalSet(LosProcessCB *processCB, UINT32 signal)
设置进程退出信号(0 ~ 7)
STATIC INLINE LosProcessCB * OsCurrProcessGet(VOID)
STATIC INLINE VOID OsProcessExitCodeCoreDumpSet(LosProcessCB *processCB)
置进程退出码第七位为1
STATIC INLINE LosTaskCB * OsCurrTaskGet(VOID)
STATIC INLINE UINT32 OsSchedLockCountGet(VOID)
STATIC INLINE VOID OsSchedLockSet(UINT32 count)
STATIC INLINE VOID OsSchedLock(VOID)
STATIC INLINE BOOL OsSchedIsLock(VOID)
VOID OsSigIntUnlock(VOID)
BOOL LOS_SpinHeld(const SPIN_LOCK_S *lock)
VOID LOS_SpinLock(SPIN_LOCK_S *lock)
VOID LOS_SpinUnlock(SPIN_LOCK_S *lock)
VOID OsExcStackInfoReg(const StackInfo *stackInfo, UINT32 stackNum)
注册栈信息
VOID OsExcStackInfo(VOID)
打印栈的信息 把每个CPU的栈信息打印出来
LITE_OS_SEC_TEXT VOID OsRunningTaskToExit(LosTaskCB *runTask, UINT32 status)
UINT32 OsShellCmdTskInfoGet(UINT32 taskID, VOID *seqfile, UINT16 flag)
STATIC INLINE BOOL OsTaskIsUnused(const LosTaskCB *taskCB)
任务是否在使用
const CHAR * OsGetRegionNameOrFilePath(LosVmMapRegion *region)
INT32 OsRegionOverlapCheckUnlock(LosVmSpace *space, LosVmMapRegion *region)
STATUS_T OsVmPageFaultHandler(VADDR_T vaddr, UINT32 flags, ExcContext *frame)
BOOL LOS_IsRegionFileValid(LosVmMapRegion *region)
映射类型为文件的线性区是否有效
LosVmSpace * LOS_SpaceGet(VADDR_T vaddr)
获取虚拟地址对应的进程空间结构体指针
STATIC INLINE BOOL LOS_IsUserAddress(VADDR_T vaddr)
虚拟地址是否在用户空间
LosVmMapRegion * LOS_RegionFind(LosVmSpace *vmSpace, VADDR_T addr)
查找线性区 根据起始地址在进程空间内查找是否存在
VADDR_T * LOS_PaddrToKVaddr(PADDR_T paddr)
通过物理地址获取内核虚拟地址
VOID LOS_DumpMemRegion(VADDR_T vaddr)
输出内存线性区
CHAR f_path[REGION_PATH_MAX]
CHAR processName[OS_PCB_NAME_LEN]
UINTPTR userMapBase
用户空间的栈顶位置,内存来自用户空间,和topOfStack有本质的区别.
CHAR taskName[OS_TCB_NAME_LEN]
struct VmMapRegion::@4::VmRegionFile rf
union VmMapRegion::@4 unTypeData
虚拟空间,每个进程都有一个属于自己的虚拟内存地址空间
vnode并不包含文件名,因为 vnode和文件名是 1:N 的关系