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

Function rt_aspace_map

components/mm/mm_aspace.c:672–710  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

670}
671
672int rt_aspace_map(rt_aspace_t aspace, void **addr, rt_size_t length,
673 rt_size_t attr, mm_flag_t flags, rt_mem_obj_t mem_obj,
674 rt_size_t offset)
675{
676 int err;
677 rt_varea_t varea = RT_NULL;
678
679 RT_DEBUG_SCHEDULER_AVAILABLE(1);
680
681 if (!aspace || !addr || !mem_obj || length == 0)
682 {
683 err = -RT_EINVAL;
684 LOG_I("%s(%p, %p, %lx, %lx, %lx, %p, %lx): Invalid input",
685 __func__, aspace, addr, length, attr, flags, mem_obj, offset);
686 }
687 else if (_not_in_range(flags, *addr, length, aspace->start, aspace->size))
688 {
689 err = -RT_EINVAL;
690 LOG_I("%s(addr:%p, len:%lx): out of range", __func__, *addr, length);
691 }
692 else if (_not_support(flags))
693 {
694 LOG_I("%s: no support flags 0x%lx", __func__, flags);
695 err = -RT_ENOSYS;
696 }
697 else
698 {
699 RT_ASSERT((length & ARCH_PAGE_MASK) == 0);
700 RT_ASSERT(((long)*addr & ARCH_PAGE_MASK) == 0);
701 err = _mm_aspace_map(aspace, &varea, addr, length, attr, flags, mem_obj, offset);
702 }
703
704 if (err != RT_EOK)
705 {
706 *addr = NULL;
707 }
708
709 return err;
710}
711
712int rt_aspace_map_static(rt_aspace_t aspace, rt_varea_t varea, void **addr,
713 rt_size_t length, rt_size_t attr, mm_flag_t flags,

Callers 15

_lwp_shmatFunction · 0.85
lwp_user_space_initFunction · 0.85
lwp_mmap2Function · 0.85
_dup_vareaFunction · 0.85
rt_aspace_map_privateFunction · 0.85
_do_mmapFunction · 0.85
on_varea_mremapFunction · 0.85
test_unmap_range_splitFunction · 0.85
mapFunction · 0.85
test_bst_adptFunction · 0.85
test_map_varea_expandFunction · 0.85

Calls 3

_not_in_rangeFunction · 0.85
_not_supportFunction · 0.85
_mm_aspace_mapFunction · 0.85

Tested by 10

test_unmap_range_splitFunction · 0.68
mapFunction · 0.68
test_bst_adptFunction · 0.68
test_map_varea_expandFunction · 0.68
aspace_delete_tcFunction · 0.68
aspace_map_tcFunction · 0.68
aspace_control_tcFunction · 0.68
test_find_freeFunction · 0.68
test_unmap_range_shrinkFunction · 0.68