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

Merge pull request !153 from zhangfanfan2/master
This commit is contained in:
openharmony_ci 2021-04-19 11:04:25 +08:00 committed by Gitee
commit 901b21e4d9
2 changed files with 7 additions and 1 deletions

View File

@ -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);
BOOL OsInsertRegion(LosRbTree *regionRbTree, LosVmMapRegion *region);
LosVmSpace *LOS_SpaceGet(VADDR_T vaddr);
LosVmSpace *LOS_CurrSpaceGet(VOID);
BOOL LOS_IsRegionFileValid(LosVmMapRegion *region);
LosVmMapRegion *LOS_RegionRangeFind(LosVmSpace *vmSpace, VADDR_T addr, size_t len);
LosVmMapRegion *LOS_RegionFind(LosVmSpace *vmSpace, VADDR_T addr);

View File

@ -59,12 +59,17 @@ LOS_DL_LIST_HEAD(g_vmSpaceList);
LosVmSpace g_kVmSpace;
LosVmSpace g_vMallocSpace;
LosVmSpace *LOS_CurrSpaceGet(VOID)
{
return OsCurrProcessGet()->vmSpace;
}
LosVmSpace *LOS_SpaceGet(VADDR_T vaddr)
{
if (LOS_IsKernelAddress(vaddr)) {
return LOS_GetKVmSpace();
} else if (LOS_IsUserAddress(vaddr)) {
return OsCurrProcessGet()->vmSpace;
return LOS_CurrSpaceGet();
} else if (LOS_IsVmallocAddress(vaddr)) {
return LOS_GetVmallocSpace();
} else {