diff --git a/arch/arm/arm/src/los_arch_mmu.c b/arch/arm/arm/src/los_arch_mmu.c index 7d7cf935c162f659acc4593966b383da29d05bee..ec6111f7d6ca46d30bd2addf3a74bd8c9f09fdff 100644 --- a/arch/arm/arm/src/los_arch_mmu.c +++ b/arch/arm/arm/src/los_arch_mmu.c @@ -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); diff --git a/kernel/base/vm/los_vm_map.c b/kernel/base/vm/los_vm_map.c index 56abd2618f95ee3755e6bde049a4a90789361449..34709c0de2b97b9a5b18e94637fd149622cdc13a 100644 --- a/kernel/base/vm/los_vm_map.c +++ b/kernel/base/vm/los_vm_map.c @@ -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, ®ion->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; }