Skip to content

Commit e3d7bbb

Browse files
zhangjing0303Rbb666
authored andcommitted
[libcpu][risc-v]:add comment for the round down of symb_pc
1 parent 3922ec7 commit e3d7bbb

File tree

1 file changed

+3
-0
lines changed
  • libcpu/risc-v/common64

1 file changed

+3
-0
lines changed

libcpu/risc-v/common64/mmu.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,9 @@ void rt_hw_mem_setup_early(void)
692692
* PC are still at lower region before relocating to high memory
693693
*/
694694
rt_ubase_t pg_idx ;
695+
/* Round down symb_pc to L1_PAGE_SIZE boundary to ensure proper page alignment.
696+
* This is necessary because MMU operations work with page-aligned addresses, and
697+
* make sure all the text region is mapped.*/
695698
ps = (rt_ubase_t)symb_pc & (~(L1_PAGE_SIZE - 1));
696699
pg_idx = GET_L1(ps);
697700
early_pgtbl[pg_idx] = COMBINEPTE(ps, MMU_MAP_EARLY);

0 commit comments

Comments
 (0)