提交 c2b31e96 编写于 作者: L laokz

修改region相关:优化OsVmRegionSplit红黑树节点操作,修改OsVmRegionAdjust起始地址不在region时的行为,修复OsIsR...

修改region相关:优化OsVmRegionSplit红黑树节点操作,修改OsVmRegionAdjust起始地址不在region时的行为,修复OsIsRegionCanExpand计算错误,更正几处typos
上级 0b2ac37c
......@@ -624,8 +624,7 @@ STATUS_T LOS_ArchMmuChangeProt(LosArchMmu *archMmu, VADDR_T vaddr, size_t count,
status = LOS_ArchMmuUnmap(archMmu, vaddr, 1);
if (status < 0) {
VM_ERR("invalid args:aspace %p, vaddr %p, count %d",
__FUNCTION__, __LINE__, archMmu, vaddr, count);
VM_ERR("invalid args:aspace %p, vaddr %p, count %d", archMmu, vaddr, count);
return LOS_NOK;
}
......@@ -832,7 +831,7 @@ STATIC VOID OsSetKSectionAttr(VOID)
kmallocLength >> MMU_DESCRIPTOR_L2_SMALL_SHIFT,
VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE);
if (status != (kmallocLength >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
VM_ERR("unmap failed, status: %d", status);
VM_ERR("mmap failed, status: %d", status);
return;
}
LOS_VmSpaceReserve(kSpace, kmallocLength, bssEndBoundary);
......
......@@ -561,7 +561,7 @@ STATIC VOID OsDevPagesRemove(LosArchMmu *archMmu, VADDR_T vaddr, UINT32 count)
status_t status;
if ((archMmu == NULL) || (vaddr == 0) || (count == 0)) {
VM_ERR("OsAnonPagesRemove invalid args, archMmu %p, vaddr %p, count %d", archMmu, vaddr, count);
VM_ERR("OsDevPagesRemove invalid args, archMmu %p, vaddr %p, count %d", archMmu, vaddr, count);
return;
}
......@@ -658,10 +658,9 @@ STATIC LosVmMapRegion *OsVmRegionSplit(LosVmMapRegion *oldRegion, VADDR_T newReg
LosVmSpace *space = oldRegion->space;
size_t size = LOS_RegionSize(newRegionStart, LOS_RegionEndAddr(oldRegion));
LOS_RbDelNode(&space->regionRbTree, &oldRegion->rbNode);
oldRegion->range.size = LOS_RegionSize(oldRegion->range.base, newRegionStart - 1);
if (oldRegion->range.size != 0) {
LOS_RbAddNode(&space->regionRbTree, &oldRegion->rbNode);
if (oldRegion->range.size == 0) {
LOS_RbDelNode(&space->regionRbTree, &oldRegion->rbNode);
}
newRegion = OsVmRegionDup(oldRegion->space, oldRegion, newRegionStart, size);
......@@ -682,15 +681,7 @@ STATUS_T OsVmRegionAdjust(LosVmSpace *space, VADDR_T newRegionStart, size_t size
LosVmMapRegion *newRegion = NULL;
region = LOS_RegionFind(space, newRegionStart);
if ((region == NULL) || (region->range.base >= nextRegionBase)) {
return LOS_ERRNO_VM_NOT_FOUND;
}
if ((region->range.base == newRegionStart) && (region->range.size == size)) {
return LOS_OK;
}
if (newRegionStart > region->range.base) {
if ((region != NULL) && (newRegionStart > region->range.base)) {
newRegion = OsVmRegionSplit(region, newRegionStart);
if (newRegion == NULL) {
VM_ERR("region split fail");
......@@ -796,7 +787,7 @@ STATUS_T OsIsRegionCanExpand(LosVmSpace *space, LosVmMapRegion *region, size_t s
nextRegion = (LosVmMapRegion *)LOS_RbSuccessorNode(&space->regionRbTree, &region->rbNode);
/* if the gap is larger than size, then we can expand */
if ((nextRegion != NULL) && ((nextRegion->range.base - region->range.base - region->range.size) > size)) {
if ((nextRegion != NULL) && ((nextRegion->range.base - region->range.base ) >= size)) {
return LOS_OK;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册