Fix mmap
This commit is contained in:
parent
abfa4988e5
commit
f62115dfef
|
@ -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) &&
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue