Skip to content

Commit 9777a96

Browse files
zhangjing0303Rbb666
authored andcommitted
[libcpu][risc-v]:add comment for the round down of symb_pc
1 parent 3c2897f commit 9777a96

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy