1
0
Эх сурвалжийг харах

[libcpu][risc-v]:add comment for the round down of symb_pc

zhangjing 2 сар өмнө
parent
commit
e3d7bbb47c

+ 3 - 0
libcpu/risc-v/common64/mmu.c

@@ -692,6 +692,9 @@ void rt_hw_mem_setup_early(void)
          * PC are still at lower region before relocating to high memory
          */
         rt_ubase_t pg_idx ;
+        /* Round down symb_pc to L1_PAGE_SIZE boundary to ensure proper page alignment.
+         * This is necessary because MMU operations work with page-aligned addresses, and
+         * make sure all the text region is mapped.*/
         ps = (rt_ubase_t)symb_pc & (~(L1_PAGE_SIZE - 1));
         pg_idx = GET_L1(ps);
         early_pgtbl[pg_idx] = COMBINEPTE(ps, MMU_MAP_EARLY);