提交 e6dae816 编写于 作者: O openharmony_ci 提交者: Gitee

!14 【轻量级 PR】:Fix mmap

Merge pull request !14 from Harylee/N/A
...@@ -240,7 +240,6 @@ STATIC INLINE BOOL LOS_IsUserAddressRange(VADDR_T vaddr, size_t len) ...@@ -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)); return (vaddr + len > vaddr) && LOS_IsUserAddress(vaddr) && (LOS_IsUserAddress(vaddr + len - 1));
} }
STATIC INLINE BOOL LOS_IsVmallocAddress(VADDR_T vaddr) STATIC INLINE BOOL LOS_IsVmallocAddress(VADDR_T vaddr)
{ {
return ((vaddr >= VMALLOC_START) && return ((vaddr >= VMALLOC_START) &&
......
...@@ -365,7 +365,7 @@ VADDR_T OsAllocRange(LosVmSpace *vmSpace, size_t len) ...@@ -365,7 +365,7 @@ VADDR_T OsAllocRange(LosVmSpace *vmSpace, size_t len)
if (nextStart < curEnd) { if (nextStart < curEnd) {
continue; continue;
} }
if ((nextStart - curEnd) >= len) { if ((curEnd + len) <= nextStart) {
return curEnd; return curEnd;
} else { } else {
curEnd = curRegion->range.base + curRegion->range.size; curEnd = curRegion->range.base + curRegion->range.size;
...@@ -379,7 +379,7 @@ VADDR_T OsAllocRange(LosVmSpace *vmSpace, size_t len) ...@@ -379,7 +379,7 @@ VADDR_T OsAllocRange(LosVmSpace *vmSpace, size_t len)
if (nextStart < curEnd) { if (nextStart < curEnd) {
continue; continue;
} }
if ((nextStart - curEnd) >= len) { if ((curEnd + len) <= nextStart) {
return curEnd; return curEnd;
} else { } else {
curEnd = curRegion->range.base + curRegion->range.size; curEnd = curRegion->range.base + curRegion->range.size;
...@@ -388,7 +388,7 @@ VADDR_T OsAllocRange(LosVmSpace *vmSpace, size_t len) ...@@ -388,7 +388,7 @@ VADDR_T OsAllocRange(LosVmSpace *vmSpace, size_t len)
} }
nextStart = vmSpace->mapBase + vmSpace->mapSize; nextStart = vmSpace->mapBase + vmSpace->mapSize;
if ((nextStart - curEnd) >= len) { if ((curEnd + len) <= nextStart) {
return curEnd; return curEnd;
} }
......
...@@ -983,6 +983,7 @@ STATIC VOID OsFlushAspace(ELFLoadInfo *loadInfo) ...@@ -983,6 +983,7 @@ STATIC VOID OsFlushAspace(ELFLoadInfo *loadInfo)
processCB->vmSpace->heapBase += OsGetRndOffset(loadInfo); processCB->vmSpace->heapBase += OsGetRndOffset(loadInfo);
processCB->vmSpace->heapNow = processCB->vmSpace->heapBase; processCB->vmSpace->heapNow = processCB->vmSpace->heapBase;
processCB->vmSpace->mapBase += OsGetRndOffset(loadInfo); processCB->vmSpace->mapBase += OsGetRndOffset(loadInfo);
processCB->vmSpace->mapSize = loadInfo->stackBase - processCB->vmSpace->mapBase;
LOS_ArchMmuContextSwitch(&OsCurrProcessGet()->vmSpace->archMmu); LOS_ArchMmuContextSwitch(&OsCurrProcessGet()->vmSpace->archMmu);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册