MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _remove_overlapped_varea

Function _remove_overlapped_varea

components/mm/mm_aspace.c:983–1010  ·  view source on GitHub ↗

remove overlapped pages from varea */

Source from the content-addressed store, hash-verified

981
982/* remove overlapped pages from varea */
983static int _remove_overlapped_varea(rt_varea_t existed, char *unmap_start, rt_size_t unmap_len)
984{
985 int error;
986 char *ex_start = existed->start;
987 char *ex_end = ex_start + existed->size;
988 char *unmap_end = unmap_start + unmap_len;
989
990 if (ex_start < unmap_start)
991 {
992 if (ex_end > unmap_end)
993 error = _split_varea(existed, ex_end, unmap_start, unmap_end, unmap_len);
994 else
995 error = _shrink_varea(existed, ex_start, unmap_start - ex_start);
996 }
997 else if (ex_end > unmap_end)
998 error = _shrink_varea(existed, unmap_end, ex_end - unmap_end);
999 else
1000 {
1001 _varea_uninstall_locked(existed);
1002 if (VAREA_NOT_STATIC(existed))
1003 {
1004 rt_free(existed);
1005 }
1006 error = RT_EOK;
1007 }
1008
1009 return error;
1010}
1011
1012static int _unmap_range_locked(rt_aspace_t aspace, void *addr, size_t length)
1013{

Callers 1

_unmap_range_lockedFunction · 0.85

Calls 4

_split_vareaFunction · 0.85
_shrink_vareaFunction · 0.85
_varea_uninstall_lockedFunction · 0.85
rt_freeFunction · 0.85

Tested by

no test coverage detected