XWOS API
4.0
XWOS C/C++ API参考手册
载入中...
搜索中...
未找到
common.h
浏览该文件的文档.
1
13
#ifndef __xwos_mm_common_h__
14
#define __xwos_mm_common_h__
15
16
#include <
xwos/standard.h
>
17
#include <assert.h>
18
25
static_assert
((XWMMCFG_ALIGNMENT >=
sizeof
(
void
*)) &&
26
(XWMMCFG_ALIGNMENT %
sizeof
(
void
*) == 0U),
27
"XWMMCFG_ALIGNMENT must be a multiple of sizeof(void *) !"
);
28
29
#define XWMM_ALIGNMENT XWMMCFG_ALIGNMENT
30
#define XWMM_UNALIGNED_MASK (XWMM_ALIGNMENT - 1U)
31
#define XWMM_ALIGNMENT_MASK (~(XWMM_UNALIGNED_MASK))
33
#define XWMM_STACK_ALIGNMENT XWMMCFG_STACK_ALIGNMENT
34
#define XWMM_STACK_UNALIGNED_MASK (XWMM_STACK_ALIGNMENT - 1U)
35
#define XWMM_STACK_ALIGNMENT_MASK (~(XWMM_STACK_UNALIGNED_MASK))
40
struct
xwmm_zone
{
41
xwptr_t
origin
;
42
xwsz_t
size
;
43
};
44
51
static
__xwcc_inline
52
bool
xwmm_in_zone
(
void
* mem,
xwptr_t
origin,
xwsz_t
size)
53
{
54
xwptr_t
memptr = (
xwptr_t
)mem;
55
bool
ret;
56
57
if
(memptr < origin) {
58
ret =
false
;
59
}
else
if
(memptr > (origin + size)) {
60
ret =
false
;
61
}
else
{
62
ret =
true
;
63
}
64
return
ret;
65
}
66
71
#endif
/* xwos/mm/common.h */
xwmm_in_zone
static bool xwmm_in_zone(void *mem, xwptr_t origin, xwsz_t size)
XWMM API:测试地址是否在内存区域内
Definition
common.h:52
__xwcc_inline
#define __xwcc_inline
Definition
compiler.h:77
xwsz_t
unsigned long xwsz_t
Definition
type.h:339
xwptr_t
unsigned long xwptr_t
Definition
type.h:375
xwmm_zone
XWOS内存区域
Definition
common.h:40
xwmm_zone::origin
xwptr_t origin
Definition
common.h:41
xwmm_zone::size
xwsz_t size
Definition
common.h:42
standard.h
XWOS的标准头文件
xwos
mm
common.h
制作者
1.9.7