!14 【轻量级 PR】:Fix mmap

Merge pull request !14 from Harylee/N/A
This commit is contained in:
openharmony_ci 2020-09-28 16:42:41 +08:00 committed by Gitee
commit e6dae81670
3 changed files with 4 additions and 4 deletions

View File

@ -240,7 +240,6 @@ STATIC INLINE BOOL LOS_IsUserAddressRange(VADDR_T vaddr, size_t len)
return (vaddr + len > vaddr) && LOS_IsUserAddress(vaddr) && (LOS_IsUserAddress(vaddr + len - 1));
}
STATIC INLINE BOOL LOS_IsVmallocAddress(VADDR_T vaddr)
{
return ((vaddr >= VMALLOC_START) &&

View File

@ -365,7 +365,7 @@ VADDR_T OsAllocRange(LosVmSpace *vmSpace, size_t len)
if (nextStart < curEnd) {
continue;
}
if ((nextStart - curEnd) >= len) {
if ((curEnd + len) <= nextStart) {
return curEnd;
} else {
curEnd = curRegion->range.base + curRegion->range.size;
@ -379,7 +379,7 @@ VADDR_T OsAllocRange(LosVmSpace *vmSpace, size_t len)
if (nextStart < curEnd) {
continue;
}
if ((nextStart - curEnd) >= len) {
if ((curEnd + len) <= nextStart) {
return curEnd;
} else {
curEnd = curRegion->range.base + curRegion->range.size;
@ -388,7 +388,7 @@ VADDR_T OsAllocRange(LosVmSpace *vmSpace, size_t len)
}
nextStart = vmSpace->mapBase + vmSpace->mapSize;
if ((nextStart - curEnd) >= len) {
if ((curEnd + len) <= nextStart) {
return curEnd;
}

View File

@ -983,6 +983,7 @@ STATIC VOID OsFlushAspace(ELFLoadInfo *loadInfo)
processCB->vmSpace->heapBase += OsGetRndOffset(loadInfo);
processCB->vmSpace->heapNow = processCB->vmSpace->heapBase;
processCB->vmSpace->mapBase += OsGetRndOffset(loadInfo);
processCB->vmSpace->mapSize = loadInfo->stackBase - processCB->vmSpace->mapBase;
LOS_ArchMmuContextSwitch(&OsCurrProcessGet()->vmSpace->archMmu);
}