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

Function rt_varea_unmap_range

components/mm/mm_aspace.c:1407–1432  ·  view source on GitHub ↗

* @note Caller should take care of synchronization of its varea among all the map/unmap operation */

Source from the content-addressed store, hash-verified

1405 * @note Caller should take care of synchronization of its varea among all the map/unmap operation
1406 */
1407int rt_varea_unmap_range(rt_varea_t varea, void *vaddr, rt_size_t length)
1408{
1409 int err;
1410 rt_base_t va_align;
1411
1412 if (!varea || !vaddr || !length)
1413 {
1414 LOG_W("%s(%p,%p,%lx): invalid input", __func__, varea, vaddr, length);
1415 err = -RT_EINVAL;
1416 }
1417 else if (_not_in_range(MMF_MAP_FIXED, vaddr, length,
1418 varea->start, varea->size))
1419 {
1420 LOG_W("%s(%p,%lx): not in range of varea(%p,%lx)", __func__,
1421 vaddr, length, varea->start, varea->size);
1422 err = -RT_EINVAL;
1423 }
1424 else
1425 {
1426 va_align = RT_ALIGN_DOWN((rt_base_t)vaddr, ARCH_PAGE_SIZE);
1427 rt_hw_mmu_unmap(varea->aspace, (void *)va_align, length);
1428 rt_hw_tlb_invalidate_range(varea->aspace, (void *)va_align, length, ARCH_PAGE_SIZE);
1429 err = RT_EOK;
1430 }
1431 return err;
1432}
1433
1434int rt_aspace_offload_page(rt_aspace_t aspace, void *addr, rt_size_t npage)
1435{

Callers 4

_null_shrinkFunction · 0.85
_null_splitFunction · 0.85
rt_varea_unmap_pageFunction · 0.85
test_varea_unmap_rangeFunction · 0.85

Calls 3

_not_in_rangeFunction · 0.85
rt_hw_mmu_unmapFunction · 0.50

Tested by 1

test_varea_unmap_rangeFunction · 0.68