WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
los_lms_pri.h
浏览该文件的文档.
1/* ----------------------------------------------------------------------------
2 * Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. All rights reserved.
3 * Description: LiteOS LMS Module Private HeadFile
4 * Author: Huawei LiteOS Team
5 * Create: 2020-09-01
6 * Redistribution and use in source and binary forms, with or without modification,
7 * are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 * conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
14 * to endorse or promote products derived from this software without specific prior written
15 * permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
18 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * --------------------------------------------------------------------------- */
28
29#ifndef _LOS_LMS_PRI_H
30#define _LOS_LMS_PRI_H
31
32#include "los_typedef.h"
33#include "los_list.h"
34#include "securec.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif /* __cplusplus */
39
40#define COMMON_ERRMODE 3
41#define FREE_ERRORMODE 2
42#define STORE_ERRMODE 1
43#define LOAD_ERRMODE 0
44
45#define SANITIZER_INTERFACE_ATTRIBUTE
46#define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
47
48#define LMS_POOL_RESIZE(size) ((size) / 17 * 16)
49#define LMS_ADDR_ALIGN(p) (((UINTPTR)(p) + sizeof(UINTPTR) - 1) & ~((UINTPTR)(sizeof(UINTPTR) - 1)))
50
51#define LMS_SHADOW_ACCESSABLE 0x00
52#define LMS_SHADOW_AFTERFREE 0x03
53#define LMS_SHADOW_REDZONE 0x02
54#define LMS_SHADOW_PAINT 0x01
55#define LMS_SHADOW_MASK 0x03
56
57#define LMS_SHADOW_BITS_PER_CELL 2
58#define LMS_MEM_BYTES_PER_SHADOW_CELL 4
59#define LMS_SHADOW_U8_CELL_NUM 4
60#define LMS_SHADOW_U8_REFER_BYTES 16
61
62#define LMS_SHADOW_ACCESSABLE_U8 0x00
63#define LMS_SHADOW_AFTERFREE_U8 0xFF
64#define LMS_SHADOW_REDZONE_U8 0xAA
65#define LMS_SHADOW_MASK_U8 0xFF
66#define LMS_SHADOW_PAINT_U8 0x55
67
68#define MEM_REGION_SIZE_1 1
69#define MEM_REGION_SIZE_2 2
70#define MEM_REGION_SIZE_4 4
71#define MEM_REGION_SIZE_8 8
72#define MEM_REGION_SIZE_16 16
73
82
89
90typedef struct {
91 UINT32 (*init)(const VOID *pool, UINT32 size);
92 VOID (*mallocMark)(const VOID *curNodeStart, const VOID *nextNodeStart, UINT32 nodeHeadSize);
93 VOID (*freeMark)(const VOID *curNodeStart, const VOID *nextNodeStart, UINT32 nodeHeadSize);
94 VOID (*simpleMark)(UINTPTR startAddr, UINTPTR endAddr, UINT32 value);
95 VOID (*check)(UINTPTR checkAddr, BOOL isFreeCheck);
96} LmsHook;
97extern LmsHook* g_lms;
98
99VOID OsLmsCheckValid(UINTPTR checkAddr, BOOL isFreeCheck);
100VOID OsLmsLosMallocMark(const VOID *curNodeStart, const VOID *nextNodeStart, UINT32 nodeHeadSize);
101VOID OsLmsLosFreeMark(const VOID *curNodeStart, const VOID *nextNodeStart, UINT32 nodeHeadSize);
102VOID OsLmsSimpleMark(UINTPTR startAddr, UINTPTR endAddr, UINT32 value);
104
107
121
122#ifdef __cplusplus
123}
124#endif /* __cplusplus */
125
126#endif /* _LOS_LMS_PRI_H */
VOID __asan_load2_noabort(UINTPTR p)
VOID __asan_store16_noabort(UINTPTR p)
VOID __asan_store4_noabort(UINTPTR p)
UINT32 OsLmsInit(VOID)
VOID __asan_loadN_noabort(UINTPTR p, UINT32 size)
VOID __asan_load8_noabort(UINTPTR p)
VOID __asan_store1_noabort(UINTPTR p)
VOID __asan_storeN_noabort(UINTPTR p, UINT32 size)
VOID __asan_store2_noabort(UINTPTR p)
LmsHook * g_lms
VOID __asan_load16_noabort(UINTPTR p)
VOID __asan_handle_no_return(VOID)
#define SANITIZER_INTERFACE_ATTRIBUTE
Definition los_lms_pri.h:45
VOID OsLmsCheckValid(UINTPTR checkAddr, BOOL isFreeCheck)
VOID OsLmsLosFreeMark(const VOID *curNodeStart, const VOID *nextNodeStart, UINT32 nodeHeadSize)
VOID OsLmsReportError(UINTPTR p, UINT32 size, UINT32 errMod)
VOID OsLmsSimpleMark(UINTPTR startAddr, UINTPTR endAddr, UINT32 value)
VOID __asan_store8_noabort(UINTPTR p)
VOID __asan_load4_noabort(UINTPTR p)
VOID __asan_load1_noabort(UINTPTR p)
VOID OsLmsPrintPoolListInfo(VOID)
VOID OsLmsLosMallocMark(const VOID *curNodeStart, const VOID *nextNodeStart, UINT32 nodeHeadSize)
#define VOID
Definition los_typedef.h:88
unsigned int UINTPTR
Definition los_typedef.h:74
unsigned int UINT32
Definition los_typedef.h:52
size_t BOOL
Definition los_typedef.h:83
Definition los_list.h:47
Definition los_lms_pri.h:83
UINTPTR shadowAddr
Definition los_lms_pri.h:85
UINT32 shadowOffset
Definition los_lms_pri.h:86
UINT32 shadowValue
Definition los_lms_pri.h:87
UINTPTR memAddr
Definition los_lms_pri.h:84
Definition los_lms_pri.h:90
Definition los_lms_pri.h:74
UINT32 shadowSize
Definition los_lms_pri.h:80
UINTPTR shadowStart
Definition los_lms_pri.h:79
LOS_DL_LIST node
Definition los_lms_pri.h:75
UINT32 used
Definition los_lms_pri.h:76
UINTPTR poolAddr
Definition los_lms_pri.h:77
UINT32 poolSize
Definition los_lms_pri.h:78