提交 901b21e4 编写于 作者: O openharmony_ci 提交者: Gitee

!153 新增LOS_CurrSpaceGet函数给外部获取当前的进程vm空间

Merge pull request !153 from zhangfanfan2/master
...@@ -273,6 +273,7 @@ VADDR_T OsAllocSpecificRange(LosVmSpace *vmSpace, VADDR_T vaddr, size_t len, UIN ...@@ -273,6 +273,7 @@ VADDR_T OsAllocSpecificRange(LosVmSpace *vmSpace, VADDR_T vaddr, size_t len, UIN
LosVmMapRegion *OsCreateRegion(VADDR_T vaddr, size_t len, UINT32 regionFlags, unsigned long offset); LosVmMapRegion *OsCreateRegion(VADDR_T vaddr, size_t len, UINT32 regionFlags, unsigned long offset);
BOOL OsInsertRegion(LosRbTree *regionRbTree, LosVmMapRegion *region); BOOL OsInsertRegion(LosRbTree *regionRbTree, LosVmMapRegion *region);
LosVmSpace *LOS_SpaceGet(VADDR_T vaddr); LosVmSpace *LOS_SpaceGet(VADDR_T vaddr);
LosVmSpace *LOS_CurrSpaceGet(VOID);
BOOL LOS_IsRegionFileValid(LosVmMapRegion *region); BOOL LOS_IsRegionFileValid(LosVmMapRegion *region);
LosVmMapRegion *LOS_RegionRangeFind(LosVmSpace *vmSpace, VADDR_T addr, size_t len); LosVmMapRegion *LOS_RegionRangeFind(LosVmSpace *vmSpace, VADDR_T addr, size_t len);
LosVmMapRegion *LOS_RegionFind(LosVmSpace *vmSpace, VADDR_T addr); LosVmMapRegion *LOS_RegionFind(LosVmSpace *vmSpace, VADDR_T addr);
......
...@@ -59,12 +59,17 @@ LOS_DL_LIST_HEAD(g_vmSpaceList); ...@@ -59,12 +59,17 @@ LOS_DL_LIST_HEAD(g_vmSpaceList);
LosVmSpace g_kVmSpace; LosVmSpace g_kVmSpace;
LosVmSpace g_vMallocSpace; LosVmSpace g_vMallocSpace;
LosVmSpace *LOS_CurrSpaceGet(VOID)
{
return OsCurrProcessGet()->vmSpace;
}
LosVmSpace *LOS_SpaceGet(VADDR_T vaddr) LosVmSpace *LOS_SpaceGet(VADDR_T vaddr)
{ {
if (LOS_IsKernelAddress(vaddr)) { if (LOS_IsKernelAddress(vaddr)) {
return LOS_GetKVmSpace(); return LOS_GetKVmSpace();
} else if (LOS_IsUserAddress(vaddr)) { } else if (LOS_IsUserAddress(vaddr)) {
return OsCurrProcessGet()->vmSpace; return LOS_CurrSpaceGet();
} else if (LOS_IsVmallocAddress(vaddr)) { } else if (LOS_IsVmallocAddress(vaddr)) {
return LOS_GetVmallocSpace(); return LOS_GetVmallocSpace();
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册