1 /* 2 * Copyright (c) 2022-2022 Huawei Technologies Co., Ltd. All rights reserved. 3 * 4 * UniProton is licensed under Mulan PSL v2. 5 * You can use this software according to the terms and conditions of the Mulan PSL v2. 6 * You may obtain a copy of Mulan PSL v2 at: 7 * http://license.coscl.org.cn/MulanPSL2 8 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 9 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 10 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 11 * See the Mulan PSL v2 for more details. 12 * Create: 2022-11-22 13 * Description: 异常模块内部头文件。 14 */ 15 #ifndef PRT_EXC_INTERNAL_H 16 #define PRT_EXC_INTERNAL_H 17 18 #include "prt_attr_external.h" 19 #include "prt_err_external.h" 20 #include "prt_sys_external.h" 21 #include "prt_cpu_external.h" 22 #include "prt_exc_external.h" 23 #include "prt_irq_external.h" 24 #include "prt_task_external.h" 25 #include "prt_hook_external.h" 26 #include "prt_mem_external.h" 27 #include "prt_sem_external.h" 28 #include "prt_task_external.h" 29 #include "prt_queue_external.h" 30 #include "prt_swtmr_external.h" 31 #include "prt_timer_external.h" 32 33 /* 34 * 模块内宏定义 35 */ 36 #define OS_EXC_DEFAULT_EXC_TYPE 0 37 38 #define OS_EXC_STACK_ALIGN 0x10U 39 40 #define OS_EXC_ESR_UNDEF_INSTR 0x20U 41 #define OS_EXC_ESR_PC_NOT_ALIGN 0x22U 42 #define OS_EXC_ESR_DATA_ABORT 0x24U 43 #define OS_EXC_ESR_SP_INSTR 0x26U 44 45 #define INVALIDPID 0xFFFFFFFFUL 46 #define INVALIDSTACKBOTTOM 0xFFFFFFFFUL 47 48 /* 49 * 模块内结构体定义 50 */ 51 /* information for esr */ 52 union TagExcEsr { 53 struct { 54 uintptr_t iss : 25; // bit[0:24] The Instruction specific syndrome field. 55 uintptr_t il : 1; // bit[25] 指令长度位,用于同步异常,0:16-bit; 0:32-bit 56 uintptr_t ec : 6; // bit[26:31] Exception class 标记错误原因 57 uintptr_t res0 : 32; // bit[32:63] 58 } bits; 59 uintptr_t esr; 60 }; 61 62 /* 63 * 模块内全局变量声明 64 */ 65 extern U32 OsVectorTable(void); 66 67 /* 68 * 模块内函数声明 69 */ 70 extern void OsExcSaveInfo(struct ExcInfo *excInfo, struct ExcRegInfo *regs); 71 72 #endif /* PRT_EXC_INTERNAL_H */ 73