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
25static_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))
40struct xwmm_zone {
43};
44
51static __xwcc_inline
52bool 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 */
static bool xwmm_in_zone(void *mem, xwptr_t origin, xwsz_t size)
XWMM API:测试地址是否在内存区域内
Definition common.h:52
#define __xwcc_inline
Definition compiler.h:77
unsigned long xwsz_t
Definition type.h:339
unsigned long xwptr_t
Definition type.h:375
XWOS内存区域
Definition common.h:40
xwptr_t origin
Definition common.h:41
xwsz_t size
Definition common.h:42
XWOS的标准头文件