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

Function rt_hw_mem_setup_early

libcpu/aarch64/common/mmu.c:914–941  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

912}
913
914void rt_hw_mem_setup_early(unsigned long *tbl0, unsigned long *tbl1,
915 unsigned long size, unsigned long pv_off)
916{
917 int ret;
918 unsigned long count = (size + ARCH_SECTION_MASK) >> ARCH_SECTION_SHIFT;
919 unsigned long normal_attr = MMU_MAP_K_RWCB;
920 extern unsigned char _start;
921 unsigned long va = (unsigned long) &_start - pv_off;
922 va = RT_ALIGN_DOWN(va, 0x200000);
923
924 /* setup pv off */
925 rt_kmem_pvoff_set(pv_off);
926
927 /* clean the first two pages */
928 rt_memset((char *)tbl0, 0, ARCH_PAGE_SIZE);
929 rt_memset((char *)tbl1, 0, ARCH_PAGE_SIZE);
930
931 ret = _init_map_2M(tbl1, va, va + pv_off, count, normal_attr);
932 if (ret != 0)
933 {
934 while (1);
935 }
936 ret = _init_map_2M(tbl0, va + pv_off, va + pv_off, count, normal_attr);
937 if (ret != 0)
938 {
939 while (1);
940 }
941}
942
943void *rt_hw_mmu_pgtbl_create(void)
944{

Callers

nothing calls this directly

Calls 3

rt_kmem_pvoff_setFunction · 0.85
rt_memsetFunction · 0.85
_init_map_2MFunction · 0.85

Tested by

no test coverage detected